[Zope3-Users] Adding indexes to a Catalog tool subclass

Tom Dossis td at yoma.com.au
Wed Sep 28 17:59:40 EDT 2005


Gary Poster wrote:
> 
> On Sep 28, 2005, at 1:53 AM, Tom Dossis wrote:
> 
>> I can add a tool which is a simple subclass of Catalog.
>> However if I try to add some index(es) in the constructor it fails  
>> with a NotYet error (see below).
>>
>> Is there a simple way to achieve this?
> 
> Yes.  Don't add the indexes with the constructor.  Add the catalog as  a 
> full utility first, as I described in my previous email, then start  
> adding indexes.

An interesting observation ..

1. Adding content into a container in the constructor does work...
2. Adding a Unique Id Utility will stop it working (NotYet error).

e.g.
class Contained(Persistent):
     implements(IContained)

class Container(BTreeContainer):
     implements(IContainer)
     def __init__(self):
         super(Container, self).__init__()
         self[u'small'] = Contained()
         self[u'medium'] = Contained()
         self[u'large'] = Contained()

Should this pattern be considered taboo in z3?



More information about the Zope3-users mailing list