I'm trying to call a Python Script from a
DTML method using
        <dtml-var "units.statistics.edit(this())">
in order to edit some numeric properties
of an object.  I have "self" as the
parameter list.

If I set the object's property "foo" to
"123" and make edit
        return(self.foo)
I get "123".  That's good.

I'd like to be able to test if "foo" is
already set, though.  It seems obvious
that I should be using hasattr(), but if
I make edit
        if hasattr(self, 'foo'):
                return('set')
        else:
                return('not set')
I get a NameError for "hasattr".

I tried making it
        if _.hasattr(self, 'foo'):
                return('set')
        else:
                return('not set')
and that doesn't generate an error, but
it returns "not set".

Any pointers?  I'm hoping I'm missing
something simple here.

BTW, I'm using today's CVS (with kludges
to make LoginManager work).

Thank you.

--kyler

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to