manipulating catalog brains directly?
hi, i'm trying to migrate a group of CMFCollectors from a Zope-2.6.2, Plone-1.0.5 site to a Zope-2.7, Plone-2.0 site. they're coming through mostly okay, but the Collector Catalog shows up on the destination site with 2 catalog entries for each issue, instead of just one. this wouldn't be so bad, except that NONE of the catalog entries are actually correct. one set of entries is mostly correct, except that they contain the wrong path to the collector issues (the location of the portal within the Zope site has changed). the other set of catalog entries has the correct paths, but are lacking all of the OTHER pertinent pieces of data, such as review_state, assigned_to, etc. what i'm trying to do is to copy the information from the old catalog entries to the ones with the correct path, so that i can run "catalog update" to purge the old entries. in an external method i've got some code like this: def fixCollectorCatalog(self): import string catalog = self.get_internal_catalog() oldbrain = catalog.search(query_request={'path':'/old/path', 'id':'42'})[0] newbrain = catalog.search(query_request={'path':'/new/path', 'id':'42'})[0] out = "%s: %s" % (newbrain.id, str(newbrain.assigned_to)) newbrain.assigned_to = ('testuser1', 'testuser2',) out += '\n\n%s: %s' % (newbrain.id, str(newbrain.assigned_to)) return out when i run this code, the output shows that the second access of 'newbrain.assigned_to' DOES actually contain the tuple that i hardcoded. this only lasts for the duration of the current request, though; the value returns to its original value on subsequent searches. how do i make my edits stick? or is there some other way to bring my catalog into sync with my collector's new location? many thanks for any help, -r
I would re-catalog all the collector's objects manually (using catalog_object), traversing folders if necessary. Then I would perform a catalog update. Ausum ----- Original Message ----- From: "Rob Miller" <ra@burningman.com> To: <zope@zope.org> Sent: Monday, April 26, 2004 9:02 PM Subject: [Zope] manipulating catalog brains directly?
hi,
i'm trying to migrate a group of CMFCollectors from a Zope-2.6.2, Plone-1.0.5 site to a Zope-2.7, Plone-2.0 site. they're coming through mostly okay, but the Collector Catalog shows up on the destination site with 2 catalog entries for each issue, instead of just one.
this wouldn't be so bad, except that NONE of the catalog entries are actually correct. one set of entries is mostly correct, except that they contain the wrong path to the collector issues (the location of the portal within the Zope site has changed). the other set of catalog entries has the correct paths, but are lacking all of the OTHER pertinent pieces of data, such as review_state, assigned_to, etc.
what i'm trying to do is to copy the information from the old catalog entries to the ones with the correct path, so that i can run "catalog update" to purge the old entries. in an external method i've got some code like this:
def fixCollectorCatalog(self): import string catalog = self.get_internal_catalog() oldbrain = catalog.search(query_request={'path':'/old/path', 'id':'42'})[0] newbrain = catalog.search(query_request={'path':'/new/path', 'id':'42'})[0] out = "%s: %s" % (newbrain.id, str(newbrain.assigned_to)) newbrain.assigned_to = ('testuser1', 'testuser2',) out += '\n\n%s: %s' % (newbrain.id, str(newbrain.assigned_to))
return out
when i run this code, the output shows that the second access of 'newbrain.assigned_to' DOES actually contain the tuple that i hardcoded. this only lasts for the duration of the current request, though; the value returns to its original value on subsequent searches.
how do i make my edits stick? or is there some other way to bring my catalog into sync with my collector's new location?
many thanks for any help,
-r
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Ausum Studio wrote:
I would re-catalog all the collector's objects manually (using catalog_object), traversing folders if necessary. Then I would perform a catalog update.
a nice idea, but digging more deeply i learned that what was actually getting lost in the transition was the association between the collector issues and the collector_issue_workflow. the issues were getting cataloged correctly, but workflow related data was no longer valid. kapil pointed me in the right direction by suggesting that the workflow status of the issues were probably being reinitialized in the manage_afterAdd method upon import. if i comment out a few lines from this method while doing the import, then everything works out. i still need to run the catalog update to get rid of the duplicates, but after that everything works as needed. :-). -r
Ausum
----- Original Message ----- From: "Rob Miller" <ra@burningman.com> To: <zope@zope.org> Sent: Monday, April 26, 2004 9:02 PM Subject: [Zope] manipulating catalog brains directly?
hi,
i'm trying to migrate a group of CMFCollectors from a Zope-2.6.2, Plone-1.0.5 site to a Zope-2.7, Plone-2.0 site. they're coming through mostly okay, but the Collector Catalog shows up on the destination site with 2 catalog entries for each issue, instead of just one.
this wouldn't be so bad, except that NONE of the catalog entries are actually correct. one set of entries is mostly correct, except that they contain the wrong path to the collector issues (the location of the portal within the Zope site has changed). the other set of catalog entries has the correct paths, but are lacking all of the OTHER pertinent pieces of data, such as review_state, assigned_to, etc.
what i'm trying to do is to copy the information from the old catalog entries to the ones with the correct path, so that i can run "catalog update" to purge the old entries. in an external method i've got some code like this:
def fixCollectorCatalog(self): import string catalog = self.get_internal_catalog() oldbrain = catalog.search(query_request={'path':'/old/path', 'id':'42'})[0] newbrain = catalog.search(query_request={'path':'/new/path', 'id':'42'})[0] out = "%s: %s" % (newbrain.id, str(newbrain.assigned_to)) newbrain.assigned_to = ('testuser1', 'testuser2',) out += '\n\n%s: %s' % (newbrain.id, str(newbrain.assigned_to))
return out
when i run this code, the output shows that the second access of 'newbrain.assigned_to' DOES actually contain the tuple that i hardcoded. this only lasts for the duration of the current request, though; the value returns to its original value on subsequent searches.
how do i make my edits stick? or is there some other way to bring my catalog into sync with my collector's new location?
many thanks for any help,
-r
Also, if you're not already doing so, use ZEO and a debug prompt so you can figure this out interactively. Cheers
participants (3)
-
Ausum Studio -
Rob Miller -
Simon Michael