[Zope] Utility functions
Jens Vagelpohl
jens@zope.com
Thu, 7 Nov 2002 07:56:37 -0500
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>