Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

adding 'context' as an alias for 'object' in action expressions

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


davidglick at onenw

Nov 29, 2008, 2:26 PM

Post #1 of 12 (1855 views)
Permalink
adding 'context' as an alias for 'object' in action expressions

Does anyone have an objection to me adding 'context' as an alias for
'object' in the expression context that is built when executing CMF
action expressions (in getExprContext in CMFCore/Expression.py)? This
would remove one common source of minor confusion for beginning CMF/
Plone developers (namely, having to use object in action expressions
when you use context everywhere else).

peace,

David Glick
Web Developer
ONE/Northwest

New tools and strategies for engaging people in protecting the
environment

http://www.onenw.org
davidglick [at] onenw
work: (206) 286-1235 x32
mobile: (206) 679-3833

Subscribe to ONEList, our email newsletter!
Practical advice for effective online engagement
http://www.onenw.org/full_signup


y.2008 at wcm-solutions

Nov 29, 2008, 3:27 PM

Post #2 of 12 (1797 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

David Glick wrote:
> Does anyone have an objection to me adding 'context' as an alias for
> 'object' in the expression context that is built when executing CMF
> action expressions (in getExprContext in CMFCore/Expression.py)? This
> would remove one common source of minor confusion for beginning
> CMF/Plone developers (namely, having to use object in action expressions
> when you use context everywhere else).

-1

"There should be one-- and preferably only one --obvious way to do it."

'context' is deprecated for this kind of expressions, CMF uses 'object'
everywhere. Supporting 'object' *and* 'context' or switching from
'object' to 'context' will cause even more confusion.

Please see this thread
http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
with this result
http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html

Cheers, Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


l at lrowe

Nov 30, 2008, 5:33 AM

Post #3 of 12 (1800 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

yuppie wrote:
> David Glick wrote:
>> Does anyone have an objection to me adding 'context' as an alias for
>> 'object' in the expression context that is built when executing CMF
>> action expressions (in getExprContext in CMFCore/Expression.py)? This
>> would remove one common source of minor confusion for beginning
>> CMF/Plone developers (namely, having to use object in action expressions
>> when you use context everywhere else).
>
> -1
>
> "There should be one-- and preferably only one --obvious way to do it."
>
> 'context' is deprecated for this kind of expressions, CMF uses 'object'
> everywhere. Supporting 'object' *and* 'context' or switching from
> 'object' to 'context' will cause even more confusion.
>
> Please see this thread
> http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
> with this result
> http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html

That thread refers to 'content' rather than 'context'.

Page templates have already made 'context' available as an alternative
to 'here'. I don't see why 'object' should be treated any differently.

"There should be one-- and preferably only one --obvious way to do it."

;-)

Laurence

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


me at rpatterson

Nov 30, 2008, 11:25 AM

Post #4 of 12 (1797 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

yuppie <y.2008 [at] wcm-solutions> writes:

> David Glick wrote:
>> Does anyone have an objection to me adding 'context' as an alias for
>> 'object' in the expression context that is built when executing CMF
>> action expressions (in getExprContext in CMFCore/Expression.py)? This
>> would remove one common source of minor confusion for beginning
>> CMF/Plone developers (namely, having to use object in action expressions
>> when you use context everywhere else).
>
> -1
>
> "There should be one-- and preferably only one --obvious way to do it."
>
> 'context' is deprecated for this kind of expressions, CMF uses 'object'
> everywhere. Supporting 'object' *and* 'context' or switching from
> 'object' to 'context' will cause even more confusion.
>
> Please see this thread
> http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.htmlwith this result
> http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html

+1

I'm not really up on the historical considerations, but I'm definitely
in favor of "context" and definitely opposed to "object". "object" is
too generic, the request is an object after all, everything is an
object. "context" reads more like what it is.

Ross

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


wichert at wiggy

Nov 30, 2008, 2:25 PM

Post #5 of 12 (1792 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Previously Laurence Rowe wrote:
> yuppie wrote:
> > David Glick wrote:
> >> Does anyone have an objection to me adding 'context' as an alias for
> >> 'object' in the expression context that is built when executing CMF
> >> action expressions (in getExprContext in CMFCore/Expression.py)? This
> >> would remove one common source of minor confusion for beginning
> >> CMF/Plone developers (namely, having to use object in action expressions
> >> when you use context everywhere else).
> >
> > -1
> >
> > "There should be one-- and preferably only one --obvious way to do it."
> >
> > 'context' is deprecated for this kind of expressions, CMF uses 'object'
> > everywhere. Supporting 'object' *and* 'context' or switching from
> > 'object' to 'context' will cause even more confusion.
> >
> > Please see this thread
> > http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
> > with this result
> > http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html
>
> That thread refers to 'content' rather than 'context'.
>
> Page templates have already made 'context' available as an alternative
> to 'here'. I don't see why 'object' should be treated any differently.
>
> "There should be one-- and preferably only one --obvious way to do it."

Amen.

+1 on making 'context' available.

Wichert.


--
Wichert Akkerman <wichert [at] wiggy> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


wichert at wiggy

Nov 30, 2008, 2:25 PM

Post #6 of 12 (1790 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Previously Laurence Rowe wrote:
> yuppie wrote:
> > David Glick wrote:
> >> Does anyone have an objection to me adding 'context' as an alias for
> >> 'object' in the expression context that is built when executing CMF
> >> action expressions (in getExprContext in CMFCore/Expression.py)? This
> >> would remove one common source of minor confusion for beginning
> >> CMF/Plone developers (namely, having to use object in action expressions
> >> when you use context everywhere else).
> >
> > -1
> >
> > "There should be one-- and preferably only one --obvious way to do it."
> >
> > 'context' is deprecated for this kind of expressions, CMF uses 'object'
> > everywhere. Supporting 'object' *and* 'context' or switching from
> > 'object' to 'context' will cause even more confusion.
> >
> > Please see this thread
> > http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
> > with this result
> > http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html
>
> That thread refers to 'content' rather than 'context'.
>
> Page templates have already made 'context' available as an alternative
> to 'here'. I don't see why 'object' should be treated any differently.
>
> "There should be one-- and preferably only one --obvious way to do it."

Amen.

+1 on making 'context' available.

Wichert.


--
Wichert Akkerman <wichert [at] wiggy> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


optilude at gmx

Nov 30, 2008, 4:19 PM

Post #7 of 12 (1785 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Wichert Akkerman wrote:
> Previously Laurence Rowe wrote:
>> yuppie wrote:
>>> David Glick wrote:
>>>> Does anyone have an objection to me adding 'context' as an alias for
>>>> 'object' in the expression context that is built when executing CMF
>>>> action expressions (in getExprContext in CMFCore/Expression.py)? This
>>>> would remove one common source of minor confusion for beginning
>>>> CMF/Plone developers (namely, having to use object in action expressions
>>>> when you use context everywhere else).
>>> -1
>>>
>>> "There should be one-- and preferably only one --obvious way to do it."
>>>
>>> 'context' is deprecated for this kind of expressions, CMF uses 'object'
>>> everywhere. Supporting 'object' *and* 'context' or switching from
>>> 'object' to 'context' will cause even more confusion.
>>>
>>> Please see this thread
>>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
>>> with this result
>>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html
>> That thread refers to 'content' rather than 'context'.
>>
>> Page templates have already made 'context' available as an alternative
>> to 'here'. I don't see why 'object' should be treated any differently.
>>
>> "There should be one-- and preferably only one --obvious way to do it."
>
> Amen.
>
> +1 on making 'context' available.

+1 as well. I could never understand why page templates used 'here',
scripts and views used 'context' (or self.context for views) and
expressions used 'object'. We have moved away from 'here' in page
templates, and settled on 'context', so why keep the inconsistency in
TALES expressions? I get it wrong nearly every time I write one. :)

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2008 at wcm-solutions

Dec 1, 2008, 2:59 AM

Post #8 of 12 (1785 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Hi!


Laurence Rowe wrote:
> yuppie wrote:
>> David Glick wrote:
>>> Does anyone have an objection to me adding 'context' as an alias for
>>> 'object' in the expression context that is built when executing CMF
>>> action expressions (in getExprContext in CMFCore/Expression.py)? This
>>> would remove one common source of minor confusion for beginning
>>> CMF/Plone developers (namely, having to use object in action expressions
>>> when you use context everywhere else).
>> -1
>>
>> "There should be one-- and preferably only one --obvious way to do it."
>>
>> 'context' is deprecated for this kind of expressions, CMF uses 'object'
>> everywhere. Supporting 'object' *and* 'context' or switching from
>> 'object' to 'context' will cause even more confusion.
>>
>> Please see this thread
>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
>> with this result
>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html
>
> That thread refers to 'content' rather than 'context'.

The links to the thread were not meant as a contribution to the
discussion if 'context' is better than 'object'. My point is that this
was discussed before and that using 'object' was an explicit decision.
(And 'context' was also considered:
http://mail.zope.org/pipermail/zope-cmf/2005-March/021957.html )

> Page templates have already made 'context' available as an alternative
> to 'here'. I don't see why 'object' should be treated any differently.
>
> "There should be one-- and preferably only one --obvious way to do it."

The proposal was to *add* an alias. That means two ways to do it. It
makes the chance higher that you guess the right name, but it doesn't
make things more obvious.

And the proposal was to change the expression context for actions. What
about CachingPolicyManager and DCWorkflow?


Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Dec 1, 2008, 7:49 AM

Post #9 of 12 (1783 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

yuppie wrote:
> Hi!
>
>
> Laurence Rowe wrote:
>> yuppie wrote:
>>> David Glick wrote:
>>>> Does anyone have an objection to me adding 'context' as an alias for
>>>> 'object' in the expression context that is built when executing CMF
>>>> action expressions (in getExprContext in CMFCore/Expression.py)? This
>>>> would remove one common source of minor confusion for beginning
>>>> CMF/Plone developers (namely, having to use object in action expressions
>>>> when you use context everywhere else).
>>> -1
>>>
>>> "There should be one-- and preferably only one --obvious way to do it."
>>>
>>> 'context' is deprecated for this kind of expressions, CMF uses 'object'
>>> everywhere. Supporting 'object' *and* 'context' or switching from
>>> 'object' to 'context' will cause even more confusion.
>>>
>>> Please see this thread
>>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html
>>> with this result
>>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html
>> That thread refers to 'content' rather than 'context'.
>
> The links to the thread were not meant as a contribution to the
> discussion if 'context' is better than 'object'. My point is that this
> was discussed before and that using 'object' was an explicit decision.
> (And 'context' was also considered:
> http://mail.zope.org/pipermail/zope-cmf/2005-March/021957.html )
>
>> Page templates have already made 'context' available as an alternative
>> to 'here'. I don't see why 'object' should be treated any differently.
>>
>> "There should be one-- and preferably only one --obvious way to do it."
>
> The proposal was to *add* an alias. That means two ways to do it. It
> makes the chance higher that you guess the right name, but it doesn't
> make things more obvious.

'context' is the canonical name for the object through which a script or
templated was acquired (its aq_parent, in fact); 'here' is a
long-deprecated alias for 'context'. 'context' is like the 'self'
binding of a normal Python method.

Action expressions aren't scripts / templates, and don't have many of
the stock names ('context', 'container', 'template', 'script',
'traverse_subpath', 'namespace', 'subpath', 'options', 'modules',
'root') which scripts and templates offer; instead, they offer names
which are useful in writing action URLs (e.g., 'object_url',
'folder_url', 'portal', 'user_id', etc.) Their 'self' / 'context' would
logically be the ActionInformation object, rather than the "target" for
which the URL / condition is being computed.


> And the proposal was to change the expression context for actions. What
> about CachingPolicyManager and DCWorkflow?

Exactly.

- -1 to the change from me. Writing TALES expressions involves knowing
what the appropriate set of names are for the given usage.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJNAeP+gerLs4ltQ4RArqDAJwMckHvg3WN4DG4tpECX47sfxedGgCg2SPB
qO8mWcKPawW7rPgRow89E3A=
=9PP6
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


me at rpatterson

Dec 1, 2008, 9:57 AM

Post #10 of 12 (1785 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Tres Seaver <tseaver [at] palladion> writes:

> yuppie wrote:
>> Hi!
>>
>>
>> Laurence Rowe wrote:
>>> yuppie wrote:
>>>> David Glick wrote:
>>>>> Does anyone have an objection to me adding 'context' as an alias for
>>>>> 'object' in the expression context that is built when executing CMF
>>>>> action expressions (in getExprContext in CMFCore/Expression.py)? This
>>>>> would remove one common source of minor confusion for beginning
>>>>> CMF/Plone developers (namely, having to use object in action expressions
>>>>> when you use context everywhere else).
>>>> -1
>>>>
>>>> "There should be one-- and preferably only one --obvious way to do it."
>>>>
>>>> 'context' is deprecated for this kind of expressions, CMF uses 'object'
>>>> everywhere. Supporting 'object' *and* 'context' or switching from
>>>> 'object' to 'context' will cause even more confusion.
>>>>
>>>> Please see this thread
>>>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021990.html>>> with this result
>>>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021999.html>> That thread refers to 'content' rather than 'context'.
>>
>> The links to the thread were not meant as a contribution to the
>> discussion if 'context' is better than 'object'. My point is that this
>> was discussed before and that using 'object' was an explicit decision.
>> (And 'context' was also considered:
>> http://mail.zope.org/pipermail/zope-cmf/2005-March/021957.html )
>>
>>> Page templates have already made 'context' available as an alternative
>>> to 'here'. I don't see why 'object' should be treated any differently.
>>>
>>> "There should be one-- and preferably only one --obvious way to do it."
>>
>> The proposal was to *add* an alias. That means two ways to do it. It
>> makes the chance higher that you guess the right name, but it doesn't
>> make things more obvious.
>
> 'context' is the canonical name for the object through which a script or
> templated was acquired (its aq_parent, in fact); 'here' is a
> long-deprecated alias for 'context'. 'context' is like the 'self'
> binding of a normal Python method.
>
> Action expressions aren't scripts / templates, and don't have many of
> the stock names ('context', 'container', 'template', 'script',
> 'traverse_subpath', 'namespace', 'subpath', 'options', 'modules',
> 'root') which scripts and templates offer; instead, they offer names
> which are useful in writing action URLs (e.g., 'object_url',
> 'folder_url', 'portal', 'user_id', etc.) Their 'self' / 'context' would
> logically be the ActionInformation object, rather than the "target" for
> which the URL / condition is being computed.

Well, isn't a view instance object very much like an ActionInformation
object in this sense? In TALES expressions in a view, "context" doesn't
refer to the view object.

Ross

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


dieter at handshake

Dec 1, 2008, 10:20 AM

Post #11 of 12 (1786 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Ross Patterson wrote at 2008-11-30 11:25 -0800:
> ...
>I'm not really up on the historical considerations, but I'm definitely
>in favor of "context" and definitely opposed to "object". "object" is
>too generic, the request is an object after all, everything is an
>object. "context" reads more like what it is.

+1

Of course, it should be consistent (as Yuppie noted), i.e.
"context" everywhere (the same way in scripts, views, actions,
templates, ....).



--
Dieter
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Dec 10, 2008, 4:43 AM

Post #12 of 12 (1662 views)
Permalink
Re: adding 'context' as an alias for 'object' in action expressions [In reply to]

Am 01.12.2008 um 16:49 schrieb Tres Seaver:

> 'context' is the canonical name for the object through which a
> script or
> templated was acquired (its aq_parent, in fact); 'here' is a
> long-deprecated alias for 'context'. 'context' is like the 'self'
> binding of a normal Python method.
>
> Action expressions aren't scripts / templates, and don't have many of
> the stock names ('context', 'container', 'template', 'script',
> 'traverse_subpath', 'namespace', 'subpath', 'options', 'modules',
> 'root') which scripts and templates offer; instead, they offer names
> which are useful in writing action URLs (e.g., 'object_url',
> 'folder_url', 'portal', 'user_id', etc.) Their 'self' / 'context'
> would
> logically be the ActionInformation object, rather than the "target"
> for
> which the URL / condition is being computed.
>
>
>> And the proposal was to change the expression context for actions.
>> What
>> about CachingPolicyManager and DCWorkflow?
>
> Exactly.
>
> - -1 to the change from me. Writing TALES expressions involves
> knowing
> what the appropriate set of names are for the given usage.


Tres,

thanks very much for the explanation. I've probably missed it but my
experience has been that Actions and Workflow are the most difficult
parts of the CMF to work with because they don't conform entirely to
the way PythonScripts or PageTemplates behave but I think this is
largely down to a lack of user/developer documentation on what they
are and how to use them. I recently encountered the problem that user
defined action categories will be ignored by ListFilteredActionsFor().
Improving the documentation here would probably be the best solution.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.