ZClass arguments dilemma
Hi All, I have a ZClass and would like to add a method to it which would allow overriding arguments to be passed to it via dtml: Example: <dtml-with myZClassInstance> <dtml-var "myMethod( link='http://domain' )"> </dtml-with> The values for the given variables (link) would be used instead of the object's Property values. The problem I have run into is that when an object method is called via DTML as above, the entire REQUEST of the object is replaced, denying accessing to the object's Property values and Methods. Example: myMethod() would no longer have access to <dtml-var id> because "id" wasn't supplied in the DTML call. All ZClass Methods or Properties are no longer available. In a Python Product you can still access the values because "self" is passed: Example: def myMethod (self, title): # use "command line" argument if given if title: pass # otherwise use the Property value else: title = self.title But with the ZClass, I can find no clear way to pass the self values for that object. Example: <dtml-with myZClassInstance> <dtml-var "myMethod( self, link='http://domain' )"> </dtml-with> What is the correct way to go about this? Thanks :) kh
----- Original Message ----- From: "Kevin Howe" <khowe@performance-net.com> To: "ZOPE-Dev Mailing List" <zope-dev@zope.org> Sent: Friday, April 28, 2000 6:12 PM Subject: [Zope-dev] ZClass arguments dilemma
Example:
<dtml-with myZClassInstance> <dtml-var "myMethod( self, link='http://domain' )"> </dtml-with>
What is the correct way to go about this?
<dtml-var "myMethod(_.None, _, link='http://domain')"> (_.None is the "client object"... most important those is passing in the _ namespace.) Kevin
On Fri, Apr 28, 2000 at 07:12:13PM -0300, Kevin Howe wrote:
But with the ZClass, I can find no clear way to pass the self values for that object.
Example:
<dtml-with myZClassInstance> <dtml-var "myMethod( self, link='http://domain' )"> </dtml-with>
What is the correct way to go about this?
<dtml-var "myMethod (this(), _, link='http://domain')"> _ is the namespace object, it's the most important part. []s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://www.webcom.com/lalo mailto:lalo@hackandroll.org pgp key in the personal page Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
participants (3)
-
Kevin Dangoor -
Kevin Howe -
Lalo Martins