[Zope] Accessing CURRENT property

Peter Bengtsson peter at fry-it.com
Wed Oct 5 06:22:22 EDT 2005


2005/10/5, Chris Withers <chris at simplistix.co.uk>:
> Peter Bengtsson wrote:
> > Not sure what it's called in Page Templates or Python Scripts but in
> > DTML it's called careful_hasattr() which wraps hasattr() in a
> > restricted context.
>
> I wouldn't trust that either ;-)
>
> hasattr's insane in that it catches prettymuch all exception, including
> ConflictErrors...
>
Didn't know that.

> I much prefer get patterns of getattr(something,'something',None) or
> variants thereof, depending on the situation...
>

careful_hasattr() uses a getattr() to test if it works and does this
in a restricted manner.

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list