[Zope] script or external method ?

Paul Winkler pw_lists at slinkp.com
Sun Apr 3 19:34:12 EDT 2005


On Mon, Apr 04, 2005 at 12:49:30AM +0200, debugworld-linux at yahoo.it wrote:
> The code i've writed imports date object from datetime
> package: this makes it
> doesn't work like a script (python), so i adapt code
> as an external method;

Maybe you could use Zope's own DateTime, which can be
used in Scripts?

> Well, 2 are the questions:
> First, what i've to do to get service variable like
> like container, context, request, etc.. ?
> Which are differences between script and external
> method coding? i remember that the zope book
> indicates only imports.

It's maybe not obvious, but implicit in the book is that the bindings
described for Scripts (container, context, etc.) apply only to Scripts,
and not for External Methods.

With External Methods, if the first argument to the function is
named "self", you can treat "self" as being equivalent to a python 
script's "context".

The request can be acquired as self.REQUEST.

The container of the external method... don't know. I never yet
had a case for an external method where I cared about the difference 
between context and container.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list