[Zope-CMF] adding 'context' as an alias for 'object' in action expressions

Martin Aspeli optilude at gmx.net
Sun Nov 30 19:19:05 EST 2008


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



More information about the Zope-CMF mailing list