[Zope] DTML Document Properties strangeness
Martijn Faassen
M.Faassen@vet.uu.nl
Wed, 02 Jun 1999 15:57:02 +0200
Alexander Staubo wrote:
>
> Martijn Faassen wrote:
> [snip]
> >Am I doing something wrong, or is this a bug? A related question: is
> >there a way to check if a property id (acquired from the folder *or*
> >defined locally in the DTML Document) exists or not (and get at its
> >contents), from within an external method? hasProperty is not working
> >well either...
>
> You can write an external method that uses the Python hasattr() function
> to check for the attribute; strangely the _ namespace has a "getattr"
> function, but none for checking the existence of an attribute. My own
> implementation looks like this:
>
> def HasAttr(Obj, Attr):
> return hasattr(Obj, Attr)
>
> This works with Acquisition.
Looks useful, thanks! It'd be nice if there were some standard DTML
accessible way to do the same.
Regards,
Martijn