[Zope-dev] ZClass arguments dilemma

Kevin Howe khowe@performance-net.com
Fri, 28 Apr 2000 19:12:13 -0300


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