[Grok-dev] Upgrading catalog utility

Roberto Allende rover at menttes.com
Tue Sep 6 12:28:53 EST 2011


Hello

Short version:
How do i recreate, ie delete an create a new catalog for an existing
application ?.

Long Version:
I need to upgrate an applcation made with grok to a new version and i
need to add a new index to its catalog. Following the example at Grok
Documentation[1], let's say i've:

class SiteCatalog(grok.Indexes):
    grok.site(Testvalueindex)
    grok.context(MyObject)
    grok.name('my_catalog')

    counter = Value()

An my new catalog has a new attribute, called new_attribute:

class SiteCatalog(grok.Indexes):
    grok.site(Testvalueindex)
    grok.context(MyObject)
    grok.name('my_catalog')

    counter = Value()
    new_attribute = grok.index.Field()

So, the problem is i've to re create SiteCatalog for my application
and "Source code for grok.index"[2] says  "Note that, since index
creation (and thus a call to our :meth:`setup()` method) currently
occurs only during the creation of a new Grok `Application` object in
the Zope Database".

I tried to instantiate the index and they monkey patch, which it
wouldn't be the most elegant solution but it could solve the problem
runing an upgrade method just once and i got an "can only be
instantiated on class level" exception.

So... any suggestion is very appreciated.

Kind Regards
Roberto Allende

1. http://grok.zope.org/documentation/how-to/implementing-search/view
2. http://grok.zope.org/doc/dev/_modules/grok/index.html


More information about the Grok-dev mailing list