Tino Wildenhain wrote:
I would like to define a class inside a python script (so I can
catalog it and use catalog to store info, as the tutorial about
catalog everything suggests).
Its not possible in Python Scripts. You would need to write either
an external method or a small product.
You also cannot easily hand instances of your own classes over to DTML
or scripts. The issue here is that your instances won't have Zope
security information. You can define and use your own classes and
instances to your heart's delight, just don't expect Zope to use them
directly. Limit yourself to returning simple Python structures like
strings, dictionaries and lists or Zope objects.
So developing a product, is the only option?
Well actually its not so hard as it seems. And products are more
easy to handle then external methods (initializing is more clear).
All you need to create a folder with a good name for your project
in the instance or common Products folder (depending on your
zope.conf ) then copy
then you edit this file to your likings based on both the documentation
(yes I know this is a bit sparse) and the hints given in that file.
Not you can define your own classes and functions in this file as
well. For better structure you are encouraged to create actual
module files in that directory instead of writing everything
into __init__.py once your create more then just a toolset.
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -