[Zope3-Users] Re: Invariants and forms
Hermann Himmelbauer <[EMAIL PROTECTED]> writes: > > Am Montag, 13. August 2007 12:01 schrieb Darryl Cousins: > > Hi, > > > > This was answered recently me thinks. > > > > http://mail.zope.org/pipermail/zope3-users/2007-August/006648.html > > I think this covers a z3c.form-related issue, but not formlib... > > Best Regards, > Hermann > Could it be that the issue relating to z3c.form is the same as for formlib? It's a relative big project and I'm using formlib, so changing to z3c.form (with resolved issue) is not possible at the moment. Best regards ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Invariants and forms
The standard error message is: There were errors I'll try your solution, but I would prefer getting the invariants to work, like mentioned in the examples. They seem to work with zope 3.2(example 1) and zope 3.4 (example 2) Thanks Best regards ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Invariants and forms
On Monday 13 August 2007 12:55, Nylan wrote: > It's a relative big project and I'm using formlib, so changing to z3c.form > (with resolved issue) is not possible at the moment. I'll note that unless you have a lot of formlib customization, switching should not be that hard. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Invariants and forms
> The standard error message is: > There were errors > 'There were errors' is default 'status message' when there are some errors. Do you have any custom template in use? Please, take a look at: zope/formlib/form.py around line 717 there is 'update' function that is interesting for you: def update(self): self.setUpWidgets() self.form_reset = False data = {} errors, action = handleSubmit(self.actions, data, self.validate) self.errors = errors if errors: self.status = _('There were errors') result = action.failure(data, errors) elif errors is not None: self.form_reset = True result = action.success(data) else: result = None self.form_result = result As you can see there is a call to 'handleSubmit' which in turn calls validation function, that calls function to check invariants. As a result in 'errors' list you should have your error message from invariants. Seems for me that this message is there because self.status is set to 'There were errors' (so 'errors' list is not empty). 'errors' list is used by ZPT: pageform.pt to display errors by default. That's why I asked if you have custom template... If above doesn't help then... do you know 'pdb'? I think you should use pdb to debug code and see what happens. Just put line: import pdb;pdb.set_trace() into above 'update' method from 'form.py' after a call to handleSubmit and check what is in errors list. Read about pdb here: http://plone.org/documentation/how-to/using-pdb -- Maciej Wisniowski ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Invariants and forms
Am 14.08.2007 um 12:13 schrieb Nylan: The standard error message is: There were errors I'll try your solution, but I would prefer getting the invariants to work, like mentioned in the examples. They seem to work with zope 3.2(example 1) and zope 3.4 (example 2) That's what the german description of the examples says. -- Yours sincerely, Michael Howitz gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users