Re: import error and deleting an object from the ZODB
dieter <[email protected]> Sat, 17 Oct 2015 08:30:49 +0200
| Newsgroups | gmane.comp.web.zope.plone.user |
|---|---|
| Message-ID | <[email protected]> |
aschmitz <[email protected]> writes: > ... so I exported each one to its own ZEXP file. > > I'm getting an error on two of the sites, when I try to import them: > > Error Type: ImportError > Error Value: No module named CacheSetup.content.caching_policy_manager > ... > Based on the export I think the ID of the problem object is 1648800. With "ID" you hopefully mean "ZODB object id" - even though, this looks strange as ZODB object ids usually are represented as hexadecimal values (beeing 8 byte binary numbers). > Can I > use this information to delete this object from the ZODB, so the export will > be importable again? The ZODB does not have a function to delete selected objects -- as this presents the danger of "dangling references". Instead, you modify other objects that "point to" the object to be deletd and remove there the reference to the object. Then "packing" will eventually delete the object once it is no longer referenced. Thus, the answer is "no". You will find in the export also the objects referencing the problematic object. Those you can load from the ZODB via code like the following, modify them (no longer to reference the object) and commit. This will allow you to clean up - if Kim's advice does not give you an easier way: # in "bin/{instance|client1} debug" from ZODB.utils import p64 obj = app._p_jar[p64(oid)] # load object with oid "oid" ------------------------------------------------------------------------------