[Zope-dev] why does an error in my externalmethod ...

Dieter Maurer dieter@handshake.de
Fri, 7 Jul 2000 00:23:01 +0200 (CEST)


Joachim Schmitz writes:
 > 
 > make the folder from which it was invoked inaccessable ?
 > 
 > continuing work on my external, I removed all modifications of self, so no
 > transactions or better modifications of the ZODB took place. During the
 > development cycle: editing the external methods, testing it through
 > calling it through the browser, after editing the method the call of
 > ..../Movies/testForm resulted in a not found error.
 > also I cannot enter the folder "Movies", if I click on it in the
 > managementscreen, I also get the not found error. There is no transaction
 > to undo, I restarted Zope no luck, I tried to delete the folder and get
 > the error:
 > 
 > Error Type: SystemError
 > Error Value: Failed to import class setrecord from module __main__

 > ....

 > The class setrecord is in my external-method. I luckily had packed zodb
 > shortly before that, and it is just a testserver. So I copied the
 > Data.fs.old to Data.fs. Till now I could not reproduce the error. I still
 > have the corrupted Data.fs. 

You should be very careful, not to store instances of
classes defined in external method files in the ZODB.

The reason:
  These Python files are not imported in a standard way,
  but instead they are read and executed.

  Therefore, the unpickler is not able to find the
  classes module, you get the problem you reported.


When you need to store class instances in the ZODB,
you should define these classes in a standard
package. The "Shared" packages is designed for this
purpose. Create an appropiately named subpackage (e.g.
company name) and put your modules there.


In your case, you may have written to a persistent object
unintentionally.


Dieter