[Zope] user defined libraries

Charlie Reiman creiman@kefta.com
Thu, 25 Jul 2002 10:08:05 -0700


These are fine suggestions, but there is a third option. Under the ZMI, go
read

Control_Panel/Products/PythonScripts/README

Summary: You can define a null product that just imports modules you want to
use. Those modules are then available for Python Script objects. The
document only discusses standard modules (re, base64, etc) but I'm assuming
that your bog-standard modules should work fine too.

FWIW, I actuall suggest #2 below if you intend to go into production, since
that will give you the best security model. My suggestion above would be
good if the module is simple and obviously secure (is there such a thing?)
or you never intend to put your server into a hostile environment, such as
the Wooly Wild Web.

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Paul
> Winkler
> Sent: Wednesday, July 24, 2002 1:59 PM
> To: zope@zope.org
> Subject: Re: [Zope] user defined libraries
>
>
> On Wed, Jul 24, 2002 at 04:50:06PM -0400, Matthew T. Bell wrote:
> > Silly question: How does one use use one's own library of Python classes
> > (imported using an import statement) inside a zope'd python
> script?  Right
> > now its giving me an error message whenever I try to do such.
>
> The "Python Scripts" which you edit through the web have severe
> security restrictions on what you're allowed to import.
>
> You can:
>
> 1) use an External Method - import anything
>
> or
>
> 2) write a Zope Product wrapper around your python module,
> providing an interface which any Zope object (python script,
> dtml pages, etc) can use to call your code.
>
> #2 is a lot more work, but very flexible in the long run.
>
> --
>
> Paul Winkler
> home:  http://www.slinkp.com
> "Muppet Labs, where the future is made - today!"
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>