[Zope] function pre-declaration?
Chris Withers
chrisw@nipltd.com
Mon, 13 Jan 2003 12:10:13 +0000
philrobinson wrote:
> Sorry, I was not clear enough:
> It's a zope python script, so I'm not actually declaring a main() function
>
> I want to do this (in a Zope 'Script (Python)')
> ++++++++++++++++++++++++++++++++++++++++
> # Main starts here
> do something...
> retval = do_util()
> do something else
> return something...
>
> # Utility functions start here
> def util_func():
> return 'a value'
> ++++++++++++++++++++++++++++++++++++++++
Try this:
> ++++++++++++++++++++++++++++++++++++++++
> # Utility functions start here
> def util_func():
> return 'a value'
>
> # Main starts here
> do something...
> retval = do_util()
> do something else
> return something...
>
> ++++++++++++++++++++++++++++++++++++++++
...alternatively, just put util_func in it's own Script (Python) (*grumble*
these _so_ should have been caleld Python Functions or Python Methods) and call
it like:
context.util_func()
...cheers,
Chris