[Zope] Re: adding a python library

Tino Wildenhain tino at wildenhain.de
Tue Nov 14 11:54:42 EST 2006


David Bear schrieb:
> On Mon, Nov 13, 2006 at 08:32:11PM -0500, Tres Seaver wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> David Bear wrote:
>>> I would like to add Mark Pilgrims feedparser to the available modules
>>> that I can use in zope. I have installed the feedparser into the
>>> python instance that zope uses. However, when I attempt to import it,
>>> I get an error that I'm not authorized. How might I make the
>>> feedparser available to zope?
>> Check the examples in
>> $SOFTWARE_HOME/lib/python/Products/PythonScripts/module_access_examples.py
>>
> 
> Thanks. This seems straightforward. However, I am now rethinking this.
> 
> What if I created a zope script and just pasted the feedparser.py
> modules contents into it. Do python scripts that live inside zodb
> become importatable?

No, not at all, a "Script (Python)" Object is much more like a
class method of the container object (e.g. Folder).

So if you write a python script in ZODB/ZMI with name foo
in folder bar, its comparable to somethign like that:

class bar:
  ...

    def foo(context,....)
        [your method body here ]

(not literally of course since acquisition
and all that comes into play, but as a thought model.

Regards
Tino


More information about the Zope mailing list