[Zope] Re: Getting at third-party modules in dtml?

Dieter Maurer dieter at handshake.de
Tue Sep 20 14:03:34 EDT 2005


Axel Straschil wrote at 2005-9-20 04:07 +0000:
>Hi!
>
>> Say I have a function that I want to make callable in
>> my UI. It needs to be globally available, i.e. it needs to
>> be callable *without* having an instance of my product yet.
>> (This has to do with listing information about all acquirable
>> instances of the product, so the user can choose from those
>> available.)
>
>In a Product's __init__.py:
>
>def theSecret(self):
>	return "A hobbit!"
>	
>methods = {
>	'whatIsFrodo':	theSecret
>}
>
>
>Save that i.E. in MyInstance/Products/MyFancy/__init__.py, restart Zope
>And than <dtml-var whatIsFrodo>. 

And if you do not want to pollute the "Folder" (class) namespace,
you can define it as a "constructors" (to "registerClass")
and use it via
"<objectManager>.manage_addProduct[<your product>].constructor(...)"

-- 
Dieter


More information about the Zope mailing list