Ben Leslie writes:
I would prefer the syntax <dtml-var "some_server.multiply(3, 4)"> but I have had problem overriding __getattr__ so I'll stick to the former for the moment.
Looking at the code, it seems essentially the same as mine (though I haven't actually run it to verify this), and I also ran into problems making the invocation syntax more natural using __getattr__ or __call__. So we can concentrate on figuring that out...
Okay can any understand how I can do this? I want to change the product so I can use the syntax <dtml-var "some_server.multiply(3, 4)"> rather than <dtml-var "some_server('multiply', 3, 4)"> Below is a snippet of code which is the closet I've come to getting this to work. Unfortunately this totally kills and persistance def __getattr__(self, name): if name in ('ages', 'add', 'multiply'): myserv = xmlrpclib.Server(self.server) return (getattr(myserv,name)) else: return Acquisition.Acquired Basically I guess what I am trying todo is test if the attribute called is a valid xml rpc method (which I am just doing hard-coded at the moment) or else do whatever Zope normally does. It is the second bit which is really starting to annoy me. I figured that is I explicitly make it acquire the attribute (as done abvove) it would force Zope to do the right thing. Unfortunately it doesn't work. Anyhelp/advice would be much appreciated. Cheers, Benno