[Zope] Portable way to get to OFS/dtml

Joel Burton joel@joelburton.com
Wed, 27 Feb 2002 21:43:25 -0500 (EST)


On Wed, 27 Feb 2002, Joel Burton wrote:

> Simple question for Python Product developers:
>
> Want to make sure that a properties management view in my product can't
> have properties added, only edited.
>
> Looked in OFS/PropertyManager.py and found the reference to
> property_extensible_schema__.
>
> Added to my product:
>
>   manage_propertiesForm=DTMLFile('../../OFS/dtml/properties', globals(),
>                                   property_extensible_schema__=0)
>
> Which works fine.
>
> Question is: what's the best way to handle getting to OFS/dtml rather
> than this ugly ugly breakable hack.

Sorry, I wrote that question before thinking about it. Bad Joel.

Quick Python reminder: globals() is not some magical, Zope-specific
incantation. It is a Python function to return the global variables.
So -> to make sure that property_extensible_schema__=0 when
PropertyManager calls DTMLFile function as above, simply set
property_extensible_schema__=0 in your product class, and voila, it
appears in the globals, and therefore, it works without having to
override manage_propertiesForm.

Ok, you can go back to what you were doing. Thanks.

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant