Hi Chris! Chris Withers wrote:
yuppie wrote:
# Support old-style product metadata. Older products may # define attributes to name their permissions, meta_types, # constructors, etc. [followed by the code that interprets the 'methods' attribute]
So 'methods' is BBB code for constructors.
That depends on how you read the above. I'd say "methods" isn't deprecated ;-)
(or, put differently, how do you provide functions needed by an "add" template? Squishdot has a need for this in obtaining a list of the available MailHosts)
If these functions are only required by a specific template there is no need to add them to the global context. You can wrap the add form in a method and pass the functions (or better the result of the functions) as argument to the template. CMF's addConfiguredSiteForm does that e.g.: http://svn.zope.org/CMF/trunk/CMFDefault/factory.py?rev=68622&view=auto If the container allows to use views (by default that is not the case for generic Folders in Zope 2.9) there is a better solution: Use a Five view and add the functions to your view class. The ZCML version of registerClass allows to specify a Five view as add form. Cheers, Yuppie