Hi, i have some problems with creating a custom edit form. Here is my complete test code:
from zope.formlib import form from zope.publisher.browser import TestRequest class MyEdit(form.EditForm): def __init__(self, context, request): self.context = context self.request = request import pdb;pdb.set_trace() # set debugger break point action = form.Action('Edit', success='handle_edit_action') self.actions = form.Actions(action) def test(): request = TestRequest() obj = object() myform = MyEdit(obj, request) If i use this code in Zope then i get an error like this: "Action object does not have an attribute 'form' ". So i used the debugger to analyze the code. After entering the debugger i looked closer at the 'actions' attribute and the 'Action' object. "print form.EditForm.actions.actions[0].__dict__" delivers this: {'failure_handler': None, 'success_handler': <function handle_edit_action at 0xb797c3ac>, 'label': u'Apply', 'validator': None, '__name__': u'actions.apply', 'data': {}, 'condition': <function haveInputWidgets at 0xb797c09c>} OK. This is the standard 'Apply' action from the EditForm class. "print self.actions.actions[0].__dict__" delivers this: {'validator': None, 'failure_handler': None, '__provides__': <zope.interface.Provides object at 0xb7780f6c>, 'form': <test.MyEdit object at 0xb7767b6c>, 'success_handler': <function handle_edit_action at 0xb797c3ac>, '__name__': u'form.actions.apply', 'data': {}, 'condition': <function haveInputWidgets at 0xb797c09c>, 'label': u'Apply'} So my first question is, where does the 'form' attribute come from? If i step over the following lines: action = form.Action('Edit', success='handle_edit_action') self.actions = form.Actions(action) then "print self.actions.actions[0].__dict__" delivers this: {'failure_handler': None, 'success_handler': <function <lambda> at 0xb7784844>, 'label': 'Edit', 'validator': None, '__name__': u'actions.edit', 'data': {}, 'condition': None} So the 'form' attribute ist gone, and will be heavily missed by ZOPE. :) Does anyone know why this happens? Thanks Alex -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users