[Zope] How to import a basic class in Script (Python)

Tudor Gabriel tdrgabi at gmail.com
Wed Jul 18 05:26:06 EDT 2007


To learn zope I am trying to write a basic library page.
I wrote a book_py class ... and from search_books_py try to return a
list of books to show in a ZPT.

now let's suppose all the files (all the py and zpt files) are in the
same directory:Library

in search_books_py i tried importing the book class in this ways:

from book_py import *
from Library.book_py import *
from here.book_py import *
from container.book_py import *

they all give ... an unauthorized access to book_py when importing.
i even renamed book_py to book.py and tried all the above imports like
from book import * ... same error.

I've searched Zope Help and it mentions in there that i have to make a
new dir in Products called whatever and add to __init__.py the
allowimport or something like that, for my package.

i tried that too ... same error (haven't restarted zope after... should
i?) .

>From Zope Help i get that only some standard python modules can be
imported this way ... 

So is there a way to simply make a class in a Script(Python) and import
it in another Script(Python).

If there isn't, and i have to make a custom Product for my Book class...
please give me a basic example of how can i make that.

Thank you for your patience.



More information about the Zope mailing list