[Zope3-dev] Re: views/foo versus context/@@foo
Philipp von Weitershausen
philipp at weitershausen.de
Fri Jun 25 03:17:30 EDT 2004
Martijn Faassen wrote:
> 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
I'm actually surprised that this works and to be honest, I'm not too
happy about it.
The 'views' namespace is somewhat magic in a way that you don't know for
what view is gotten? For context? For zope.interface.Interface? You
wouldn't know. That's why the context/@@foo notation is always
preferable because it makes it quite clear for what object you get the view.
So, I think we should once and for all deprecate 'views' (not just in
our telling people, but in the code!) and hunt down the places where the
'@@' is left out. Furthermore, we should make the context/foo magic
disappear (or at least generate deprecation warnings), so that in the
future, only context/@@foo is possible for views.
$ python -c "import this" | grep implicit
Explicit is better than implicit.
Philipp
More information about the Zope3-dev
mailing list