On Sat, Apr 11, 2009 at 06:37:18PM +0100, Chris Withers wrote: > Hi All, > > Suppose I have the following: > > a = Folder() > b = Folder() > c = Folder() > > a.b = b > a.c = c > > What's the canonical way of registering a view on b that is different to > a view of the same name on a, and ditto with c?
Marker interfaces. alsoProvides(b, IMyVerySpecialFolder) alsoProvides(c, ISomeOtherKindOfAVerySpecialFolder) # alternatively, subclass Folder, make it implement those marker # interfaces, then make b and c instances of your folder subclasses. Or you could hook up a custom traverser (i.e. an adapter on (ISomeInterfaceDistinguishingAFromAllOtherFolders, IBrowserRequests) to IBrowserPublisher) and do magic in its publishTraverse (maybe wrap the subfolders 'b' and 'c' in some kind of proxies that provide interfaces). Handwave, handwave. I do not recommend this way. Marius Gedminas -- http://pov.lt/ -- Zope 3 consulting and development
signature.asc
Description: Digital signature
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )