Hi there,

I noticed another possible oddness with zc.page. When I subclass form.PageEditForm, I normally get an 'edit' action provided with it, as the baseclass defines this.


If I however add my own actions in the subclass, like this:

@form.action("Another")
def handle_another_action(self, action, data):
    ...

the 'edit' action just disappears from the action list.

Not daunted by this, I tried the following to restore the edit action:

@form.action("Edit")
def handle_edit_action(self, action, data):
    super(MyClass, self).handle_edit_action(action, data)

The 'Edit' button now appears in the form. Unfortunately submitting it using this button results in:

TypeError: 'Action' object is not callable

Not giving up, I tried it another way, and placed this in the class, above the place where the extra action gets defined:

    actions = form.Actions(
        form.Action("Edit", success="handle_edit_action"),
        )

Unfortunately no luck either when I submit:

File "/home/faassen/working/doclib/py/zc/page/form.py", line 735, in __call__
    self.update()
File "/home/faassen/working/doclib/py/zc/page/form.py", line 715, in update
    result = action.success(data)
File "/home/faassen/working/doclib/py/zc/page/form.py", line 567, in success
    return self.success_handler(self.form, self, data)
File "/home/faassen/working/doclib/py/zc/page/form.py", line 507, in <lambda>
    callable = lambda form, action, data: getattr(form, f)(action, data)
TypeError: 'Action' object is not callable

Is this a bug?

Regards,

Martijn
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to