[Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream
Christian Klinger
cklinger at novareto.de
Fri Jun 24 07:50:33 EDT 2011
Hi
i double checked it:
class AddForm(...)
def createAndAdd(self, data):
ob = self.create(data)
zope.event.notify(ObjectCreatedEvent(ob))
return self.add(ob)
def create(self, data):
raise NotImplementedError(
"concrete classes must implement create() or createAndAdd()")
So if you create in your add form something like this:
class MYAddForm(AddForm):
def create(self, data):
return MyObject(data)
the catalog stuff is done for you.
HTH Christian
> Hello
> On Fri, 2011-06-24 at 12:17 +0200, Christian Klinger wrote:
>> what do you mean with "via zope.formlib AddForms's createAndAdd' method.
>>
>> Do you override this method? If so this is wrong you only have to
>> add a create method which get's called before the object is persisted in
>> the container. The createAndAdd method triggers then the catalog.
>
> Oh!! I never knew that. I was following the bluebream documentation at
> http://bluebream.zope.org/doc/1.0/tutorial2.html#adding-tickets there
> they were overriding the 'createAndAdd' method of AddForm.
>
> Anyways I'll try the 'create' method and get back.
>
> Thanks
>
>
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev at zope.org
> https://mail.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> https://mail.zope.org/mailman/listinfo/zope-announce
> https://mail.zope.org/mailman/listinfo/zope )
More information about the Zope-Dev
mailing list