Re: [Zope] siblings of me, rather than of parent
ahahhaha!!! (sorry, been up _way_ too long.) the trick was returning ob.aq_base.__of__(self), not ob.aq_inner.__of__(self)! Seems to work great now. -Randy - Original Message - From: Randall Kern To: [EMAIL PROTECTED] Sent: Sunday, December 03, 2000 11:08 PM Subject: Re: [Zope] siblings of me, rather than of parent Sorry, my __bobo_traverse__ method is working, the PARENTS stack is exactly as I would hope, with my module as the parent of the category, rather than the root. Here's the whole story: / index_html (dtml method) index.html (dtml method) category (Folder) foo.html (dtml method) blah (Module) category (Folder) header.html (dtml method) weather (Category) /index_html: /index.html: Now, what I hope to happen is that the dtml-with would bind to the /blah/category folder, and therefore be able to find header.html. However, somehow it's getting the /category folder instead, which doesn't have header.html. Anyone understand why this is happening? Thanks again, -Randy - Original Message - From: Randall Kern To: [EMAIL PROTECTED] Sent: Sunday, December 03, 2000 8:08 PM Subject: [Zope] siblings of me, rather than of parent 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
Sorry, my __bobo_traverse__ method is working, the PARENTS stack is exactly as I would hope, with my module as the parent of the category, rather than the root. Here's the whole story: / index_html (dtml method) index.html (dtml method) category (Folder) foo.html (dtml method) blah (Module) category (Folder) header.html (dtml method) weather (Category) /index_html: /index.html: Now, what I hope to happen is that the dtml-with would bind to the /blah/category folder, and therefore be able to find header.html. However, somehow it's getting the /category folder instead, which doesn't have header.html. Anyone understand why this is happening? Thanks again, -Randy - Original Message - From: Randall Kern To: [EMAIL PROTECTED] Sent: Sunday, December 03, 2000 8:08 PM Subject: [Zope] siblings of me, rather than of parent 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
[Zope] siblings of me, rather than of parent
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