[Zope] manipulating catalog brains directly?

Ausum Studio ausum_studio at hotmail.com
Tue Apr 27 10:47:59 EDT 2004


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 at burningman.com>
To: <zope at 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 at 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 )
>



More information about the Zope mailing list