[Zope] Bug in Zope?
VanL
vlindberg@verio.net
Wed, 11 Sep 2002 11:04:06 -0600
Hello,
We are doing a migration of some old data (stored in a standard format
in text files) into the ZODB.
We have two methods:
ImportCDF is a pythonscript. It receives a filename and batchname
(these terms will be explained in a moment.) It gives the file name to
the second (external) function, ReadCDF. This part appears to be working.
ReadCDF opens the external file puts each record into a dict. It then
returns these dict/records one at a time, using yield. This function
appears to be working.
Import CDF then resumes control. It first takes the batchname and uses
it for the id if a batch info object (a custom object that we have
created). Then it loops over the records returned from ReadCDF,
creating an object for each returned record.
Here is the problem:
We run this with one cdf (the external text file) and it works
correctly. We then run it with a second cdf and it runs correctly.
Then we run it with a third, and it fails with:
Error Type: Unauthorized
Error Value: You are not allowed to access POSException in this context
The function in ImportCDF that throws this exception is:
# Loop through our CDF dictionary records
for cdfrec in cdf:
cemail = cdfrec['Contact Email']
czopeid = cdfrec['CID']
# If the customer exists, getattr it. Otherwise create it.
if(not hasattr(customers,czopeid)):
#print "Adding Customer Info for "+czopeid
try:
customers.manage_addProduct['MigrationManager'].manage_addCustomerInfo(id=czopeid)
objects_created = objects_created + 1
except ZODB.POSException.ReadConflictError:
continue
Afterwords, the script will throw this same exception for the cdf input
files for which it previously worked; i.e., the error is persistent.
However, if you cut and paste the contents of ImportCDF into a new
script (e.g., Import-CDF) and run it, it will work correctly until we
run it on the bad CDF. After that, the error will persist in the new
script.
We cannot find any way in which the third (bad) CDF is different than
the first two (good) CDFs. They are all the output of the same parser,
and all validate as being correctly formatted. The data has no binary
characters or anything, this is just an XMLish data file. Further, the
function that actually deals with the file seems to have no trouble with it.
This entire sequence of events is quite baffling to us, especially the
fact that the error persists after it has been thrown once -- the script
never functions correctly again.
Any help or insight would be greatly appreciated. More specific
information available on request. This is Zope 2.5.1, without the 6-14
hotfix (yet), running on python 2.2.0 on FreeBSD 4.
Products installed: CatalogQuery, ExternalEditor, LocalFS, and the
package with our custom objects (mostly based off Kube).
Thanks,
VanL