[Zope] Using Classes in Python scripts

Andreas Tille tillea@rki.de
Tue, 6 Aug 2002 14:05:44 +0200 (CEST)


Hi,

I just want to hold some data structures in the session data.  The
application I want to write gatheres data from a database according to
several options which can be set in a several step menu system.  I have
to keep track to the options.

After reading  /Examples/ShoppingCart  of the Zope hierarchy I tried to
adopt this scheme of data tagged by keys in the session data but I found
out that I lost overview about this stuff if I would dive deeper into
the data structure I would need.

I thought I would find the solution in defining my own class variables
and found out that this is not possible in Python scripts for security
reasons.  Next I tried External Python methods but I've got strange
effects with this approach and I think it would not work as well.

I thought I would find the solution at

     http://www.zopelabs.com/cookbook/991933953

but I just got an error right in the first line of the example code:

    Zope has encountered an error while publishing this resource.

    Error Type: ImportError
    Error Value: import of "Products.PythonScripts.Utility" is unauthorized

So I have two questions:

   1. Is this the right approach to accumulate several data in the
      session variable even if there is a more complex menu structure
      of options which are sometimes dependand one from some others.

   2. If yes what is the best way to get this working.

Kind regards

       Andreas.