[Zope-CMF] Implementing utitlity functions in a product to be used by ZPT

Rainer Thaden Rainer Thaden <thadi@gmx.de>
Mon, 1 Jul 2002 11:35:26 +0200


Hi,

I built a product for CMF with some classes in it and have lots of
small python scripts which are used for conversions etc.
I'd like to put all these small helper functions in one file which
is available in page templates.
So i created a file my_utils.py in the product directory in which i
dumped the functions and added some security attributes:


from AccessControl import ModuleSecurityInfo

ModuleSecurityInfo('my_utils').declarePublic('pyfunction')
 
def pyfunction(context, args)
...

Maybe this is not correct, because it is no module?

How do i import this into page templates? Did i miss something?
And if i manage to call the functions from ZPT, do i have to pass the
context as a parameter like so:
 ... tal ... pyfunction(here) ?

Sorry, i still have to learn much about python, but maybe someone can
point me to a location, where i find some docs about this.
 

-- 
Regards,
 Rainer                          mailto:thadi@gmx.de