Jens: Thanks. I'd like to keep them in the ZODB (not on disk) for ease of administration & installation of the resulting site. However, keeping them in separate python script objects is a pain when editing/updating them. Seems to me it would be useful to have some type of Zope object that would allow definition of multiple functions in a single "file". A. -----Original Message----- From: Jens Vagelpohl [mailto:jens@zope.com] Sent: Thursday, November 07, 2002 7:57 AM To: Andrew Athan Cc: Zope@Zope. Org Subject: Re: [Zope] Utility functions you could put them into a single place, e.g. a folder off your zope root directory, so they don't clutter up the ZMI if that's your concern. thee certainly is no problem creating a bunch of python scripts. jens On Wednesday, Nov 6, 2002, at 23:03 US/Eastern, Andrew Athan wrote:
What is the idiomatic way of expressing utility functions? I.e., python scripts that are meant to be callable by a variety of templates, dtml methods, other python scripts, etc. but which tend to be small, useful, and usually oriented at manipulating data (not generating html).
Creating lots of separate Python (Script) objects seems like overkill, yet defined functions inside such a script don't seem to be easily accessible outside the script object.
E.g.
Script1 ---------
def foo(a): return a[0]
request= container.REQUEST
<blah blah> return container.resultPage()
Script2 -------- <blah> container.Script1.foo(x)
The call in Script2 doesn't work...I'll go read the source for a script object and see if there's an attribute that gives me the access I'm looking for, but I thought I'd ask the list, too.
aathan <Andrew Athan>