[Zope3-Users] Re: What's the rationale of @@ ? Was: index.html
jim at zope.com
Tue Dec 13 17:01:58 EST 2005
Jeff Rush wrote:
> Frank Burkhardt wrote:
>> On Tue, Dec 13, 2005 at 02:02:05PM +0100, Andreas Elvers wrote:
>>> what the rationale of @@ anyway ? I've searched for a definition for
>>> this in the Developer Handbook and elsewhere but it's hard to search
>>> for @@ and view.
>> @@ marks a given path component explicitely as a view of the previous
>> Could mean either "The object named 'contents.html' in the root
>> folder" or
>> (if there is no such object) "The 'contents.html' view (List of contained
>> objects) of the root folder" - the object is preferred.
>> Will always display the list of contained objects of the root folder -
>> no matter
>> if there's a object 'contents.html' or not.
> Hmm, but the '@@' is optional, as I can leave it off and still get the
> contents.html view if there is no object named contents.html in that
> This would seem to confuse developers, as if there IS an accidental
> collision of an item name with a view that is unknown to the developer,
> it will return the view out of nowhere.
No, it will return the view.
> Shouldn't the '@@' should be *required* on views to avoid this ambiguity?
This is a matter of policy. It is straightforward to change. Many people hate
@@ and the ++view++name syntax. They will often arrange their item and view
names so that they don't overlap.
It might be nice to have easily-configured alternate policies. For example:
- require @@, as you suggest
- log a warning, or possible raise an error in development mode, if, when you
get an item, you also find a view with the same name.
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-users