-----Original Message----- From: Alexander Staubo [mailto:alex@mop.no] Sent: Thursday, July 22, 1999 1:01 PM To: Zope Mailing List (E-mail) Subject: [Zope] Extending <!--#var fmt=...-->
I asked this before, but I don't recall getting any responses.
It seems that you can write
<!--#var SomeVariable fmt=SomeMethod-->
and SomeMethod -- assuming it is, for example, an External Method -- will be called. Unfortunately it seems SomeMethod is not called with any parameters -- meaning it cannot access the variable or value to be rendered.
Actually the intended behavior is to be: <!--#var someObject fmt=someMethodofSomeObject--> So the method called is supposed to be a method of 'someObject', however, due to the beauty of acquisition, an unitended result is that if someObject is wrapped, it will acquire a method if it doesn't have one and one is acquirable. This is why your external method gets called. The intention of having no parameters was that because the method is of the object you want to render, it can simply get any any values it needs using it's self reference. This is how DatTime objects work, which is you can: <!--#var dateTimeInstance fmt=day--> Which will call 'dateTimeInstance.day()'. I think, I'm not sure, but I think that if you pass 'self' into your external method as it's first argument, it should bind the method to the object in question. I'm not sure though. Of course, if you want to modify the behavior of fmt to support some kind of expression syntax, your more than welcome to. We will evaluate the patch and include it. -Michel
Is this by design? Is there any way of extending fmt= by having it call our methods with the value as a parameter? I've successfully patched the appropriate source code to verify that it is indeed possible to do what I'm looking for, so... why not? Security reasons?
-- Alexander Staubo http://www.mop.no/~alex/ "`Ford, you're turning into a penguin. Stop it.'" --Douglas Adams, _The Hitchhiker's Guide to the Galaxy_
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )