Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream
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 -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
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@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 )
Hello, On Fri, 2011-06-24 at 13:50 +0200, Christian Klinger wrote:
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.
If I override just the 'create' method I get the ForbiddenAttribute for 'add' operation on self.context.add(object) in zope.formlib.form.AddFormBase.add method. Here the 'self.context' is a BTreeContainer whose interface is derived from IContainer and the ZCML config for that class is marked as <class class="..." <implements interface="zope.container.interfaces.IContentContainer" /> ... </class> If I add the zcml config for that class to allow attribute like this ... <allow attributes="add" /> ... I get AttributeError stating that the object has no attribute 'add' How do I fix this? -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
On Fri, 2011-06-24 at 19:13 +0530, Joshua Immanuel wrote:
If I override just the 'create' method I get the ForbiddenAttribute for 'add' operation on self.context.add(object) in zope.formlib.form.AddFormBase.add method.
If I add the zcml config for that class to allow attribute like this
... <allow attributes="add" /> ...
I get AttributeError stating that the object has no attribute 'add'
To fix this if I add a method named 'add' to that container like this def add(self, object): self['some_unique_id'] = object I get a ForbiddenAttribute error for 'nextURL'. I guess there is a better way to do this. Please guide me. -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Hi, sorry i have no idea with AttributeErrors. I use grok which has a different security policy. Christian
On Fri, 2011-06-24 at 19:13 +0530, Joshua Immanuel wrote:
If I override just the 'create' method I get the ForbiddenAttribute for 'add' operation on self.context.add(object) in zope.formlib.form.AddFormBase.add method.
If I add the zcml config for that class to allow attribute like this
... <allow attributes="add" /> ...
I get AttributeError stating that the object has no attribute 'add'
To fix this if I add a method named 'add' to that container like this
def add(self, object): self['some_unique_id'] = object
I get a ForbiddenAttribute error for 'nextURL'.
I guess there is a better way to do this. Please guide me.
_______________________________________________ Zope-Dev maillist - Zope-Dev@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 )
Hello Christian, On Fri, 2011-06-24 at 17:58 +0200, Christian Klinger wrote:
sorry i have no idea with AttributeErrors. I use grok which has a different security policy.
I don't think its a problem related with security policy. Moreover I've configured zcml to use zope.Public permission everywhere. Anyways. Thanks for trying to help me. -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
participants (2)
-
Christian Klinger -
Joshua Immanuel