[Zope3-dev] views/foo versus context/@@foo
Martijn Faassen
faassen at infrae.com
Wed Jun 23 11:43:52 EDT 2004
Hi there,
Currently in Zope 3 in its page templating engine there is a 'views'
name defined that can be used to access a particular view in TALES, like
this:
views/foo
or
python:views['foo']
I heard that this is deprecated in favor of:
context/@@foo
or presumably in Python, something like:
python:path('context/@@foo')
I have a few comments to make.
A cursory grepping of the Zope 3 codebase saw a lot of instances where
instead of:
context/@@foo
we see
context/foo
This works, until there's actually a name clash with something called
'foo' in content space, like the user adding an object called 'foo'.
That's an annoying type of bug; code should just not work or work fine,
instead of having a booby trap waiting for it.
You can tell people to always use @@ but that's a weak way to prevent
bugs. You need to tell people. People need to read it. People need to
understand the severity of the problem and decide to use @@. And then
finally people need to actually not accidentally forget.
If instead you told people to always use 'views' if they want a view,
things are a lot easier to do right.
Of course 'views' has a problem in that it is named rather confusingly
similar to 'view'. Perhaps a new, better, term for 'views' needs to be
devised.
Regards,
Martijn
More information about the Zope3-dev
mailing list