Re: [Zope-dev] getattr'ing proxy object's methods
Kent Polk writes:
.... I do not understand your goal precisely... However, the surrogate technique used in "CMFCore.DirectoryView.DirectoryView" may come near to your proxie objects.
Dieter
On 13 Apr 2001 05:50:01 -0500, Dieter Maurer wrote:
Kent Polk writes:
.... I do not understand your goal precisely... However, the surrogate technique used in "CMFCore.DirectoryView.DirectoryView" may come near to your proxie objects.
I played around with that and can't quite see how to map the proxy namespace onto the current one. I basically want to do a dtml-with in Python for the proxy clients. so that: <dtml-in "getTable(...)"> automatically adds the proxy's namespace, instead of having to do: <dtml-with Proxy> <dtml-in "getTable(...)"> where: def Proxy(self): """Return the proxy associated with this object""" return getattr(self, self.proxy_id) __call__ is never called in this context as it's trying to locate a method (that doesn't exist for the proxy client), so that's out. __of__, of course probably is the key, but I can't determine how to push the proxy's namespace onto the current call, much less be able to do anything with it since hasattr(self, self.proxy_id) returns 0 in the context of the __of__ call for the proxy client. I don't understand that one since self appears to be the correct object. I presume it has something to do with preventing recursion... I also tried adding the proxy's namespace to the client when created, which was quite interesting, but not quite what I had in mind. :^) That appears to leave me with just __bobo_traverse__, which can correctly locate the proxy object but I can't determine how I could use it to either directly call the proxy method (can't identify the method from inside __bobo_traverse__) or add the proxy's namespace in the context of __bobo_traverse__. Thanks!
participants (2)
-
Dieter Maurer -
kent@tiamat.goathill.org