[Zope] Using Zclasses

Alexander Staubo alex@mop.no
Wed, 7 Jul 1999 05:04:42 +0200


Fyi, it is not documented in the Document Template Markup Language
User's Guide. Not all of us venture into the sources to find features we
don't see in the documentation, Michel.

--
Alexander Staubo             http://www.mop.no/~alex/
"What the hell, he thought, you're only young once, and threw
himself out of the window. That would at least keep the element of
surprise on his side."
--Douglas Adams, _The Hitchhiker's Guide to the Galaxy_

>-----Original Message-----
>From: Michel Pelletier [mailto:michel@digicool.com]
>Sent: 7. juli 1999 04:08
>To: 'Alexander Staubo'; Zope Mailing List (E-mail); 'Michael Bernstein'
>Subject: RE: [Zope] Using Zclasses
>
>
>> -----Original Message-----
>> From: Alexander Staubo [mailto:alex@mop.no]
>> Sent: Monday, July 05, 1999 10:28 PM
>> To: Zope Mailing List (E-mail); 'Michael Bernstein'
>> Subject: RE: [Zope] Using Zclasses
>>
>>
>> or something like that, assuming HasAttr() is an External Method that
>> tests for the existence of a property (I have not found this
>> functionality in Zope's built-in DTML API: The closest I you get is
>> getattr, which raises an error if it fails). I implement
>this function
>> like so::
>>
>>   def HasAttr(o, attr):
>>     return hasattr(o, attr)
>>
>
>The _ namespace has a hasattr.  Quote DocumentTemplate/DT_Util.py:
>
>  This variable also has attributes that provide access to standard
>  utility objects.  These attributes include:
>
>  - The objects: 'None', 'abs', 'chr', 'divmod', 'float', 'hash',
>       'hex', 'int', 'len', 'max', 'min', 'oct', 'ord', 'pow',
>       'round', and 'str' from the standard Python builtin module.
>
>  - Special security-aware versions of 'getattr' and 'hasattr',
>
>  - The Python 'string', 'math', and 'whrandom' modules, and
>
>  - A special function, 'test', that supports if-then expressions.
>    The 'test' function accepts any number of arguments.  If the
>    first argument is true, then the second argument is returned,
>    otherwise if the third argument is true, then the fourth
>    argument is returned, and so on.  If there is an odd number of
>    arguments, then the last argument is returned in the case that
>    none of the tested arguments is true, otherwise None is
>    returned.
>
>
>
>-Michel
>
>> --
>> Alexander Staubo             http://www.mop.no/~alex/
>> "What the hell, he thought, you're only young once, and threw
>> himself out of the window. That would at least keep the element of
>> surprise on his side."
>> --Douglas Adams, _The Hitchhiker's Guide to the Galaxy_
>>
>>
>> _______________________________________________
>> Zope maillist  -  Zope@zope.org
>> http://www.zope.org/mailman/listinfo/zope
>>
>> (For developer-specific issues, use the companion list,
>> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>>
>