My site has two main classes of objects, Modules
(and their derivatives), and Categories. A normal setup might look
something like this:
root
blab
(Module)
weather (Category)
rain
(Category)
sun
(Category)
region (Category)
I need to handle URLs like
/root/blab/weather. The problem is that I need weather.__of__(blab) on the
stack, rather than weather.__of__(root) on top. This is because blab (in
some cases) overrides default behaviors from root.
I thought the proper way to do this was by adding a
__bobo_traverse__ method to my Module, like this:
def __bobo_traverse__(self, REQUEST,
name):
try: parents = REQUEST['PARENTS'] parent = parents[-2] if hasattr(parent, name): ob = getattr(parent, name) if ob.meta_type == 'Category': return ob.aq_inner.__of__(self) except: pass return
getattr(self, name)
But that doesn't seem to change anything, although
it does perform the return (and doesn't throw any exceptions.)
Basically, I'm trying to offer my siblings as if
they were my children, so if they fail to offer something, it will be looked for
in me, rather than my parent.
Thanks,
-Randy
|
- Re: [Zope] siblings of me, rather than of parent Randall Kern
- Re: [Zope] siblings of me, rather than of parent Randall Kern
- Re: [Zope] siblings of me, rather than of parent Randall Kern