Re: [Zope3-Users] how to use invariant/validator? (z3c.form=1.6 and z3c.formui=1.3)
On Friday 21 September 2007, Kai Krackler wrote: > - __traceback_info__: ( 0x2b2d6e6af440>, 'widget', ['label']) TypeError: tuple indices must be > integers Does this error still happen with z3c.form 1.8? Regards, Stephan -- Stephan Richter Web Software Design, Development and Training Google me. "Zope Stephan Richter" ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to use invariant/validator? (z3c.form=1.6 and z3c.formui=1.3)
> Hi, can you please include a complete traceback to see where the > exception occurres? > > -- > Yours sincerely, > Michael Howitz > > gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale > www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891 > Hi Michael, thank you for your efforts! I've just listed the last lines of traceback, because it's very long. If there is not enough information, I'll send the other part too of course. traceback: ... File "/home/kikr/buildout-eggs/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", line 346, in interpret handlers[opcode](self, args) File "/home/kikr/buildout-eggs/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", line 623, in do_insertText_tal text = self.engine.evaluateText(stuff[0]) File "/home/kikr/buildout-eggs/zope.tales-3.4.0a1-py2.4.egg/zope/tales/tales.py", line 704, in evaluateText text = self.evaluate(expr) File "/home/kikr/buildout-eggs/zope.tales-3.4.0a1-py2.4.egg/zope/tales/tales.py", line 696, in evaluate return expression(self) - /home/kikr/buildout-eggs/z3c.formui-1.3.0-py2.4.egg/z3c/formui/div-form.pt - Line 38, Column 12 - Expression: - Names: {'args': (), 'context': , 'default': , 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': http://localhost:8080/++skin++Z3CFormHapo/search.html>, 'template': , 'view': , 'views': } File "/home/kikr/buildout-eggs/zope.tales-3.4.0a1-py2.4.egg/zope/tales/expressions.py", line 217, in __call__ return self._eval(econtext) File "/home/kikr/buildout-eggs/zope.tales-3.4.0a1-py2.4.egg/zope/tales/expressions.py", line 194, in _eval ob = self._subexprs[-1](econtext) File "/home/kikr/buildout-eggs/zope.tales-3.4.0a1-py2.4.egg/zope/tales/expressions.py", line 124, in _eval ob = self._traverser(ob, element, econtext) File "/home/kikr/buildout-eggs/zope.app.pagetemplate-3.4.0b1dev_r75616-py2.4.egg/zope/app/pagetemplate/engine.py", line 68, in __call__ request=request) File "/home/kikr/buildout-eggs/tmpmMrIdt/zope.traversing-3.5.0a1.dev_r78730-py2.4.egg/zope/traversing/adapters.py", line 164, in traversePathElement - __traceback_info__: (, 'widget') File "/home/kikr/buildout-eggs/tmpmMrIdt/zope.traversing-3.5.0a1.dev_r78730-py2.4.egg/zope/traversing/adapters.py", line 49, in traverse - __traceback_info__: (, 'widget', ['label']) TypeError: tuple indices must be integers Kai -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to use invariant/validator? (z3c.form=1.6 and z3c.formui=1.3)
Am 19.09.2007 um 12:49 schrieb [EMAIL PROTECTED]: Hi, I want to use an invariant-check in an analogous manner like it is described at the end of the message. There is answered that the bug is fixed, but the same causes are still active. I'm using z3c.form=1.6 and z3c.formui=1.3 What seems to be the trouble now? my code: class IAddressSearch(zope.interface.Interface): ... @zope.interface.invariant def firstnameOrSurname( search ): #import pdb; pdb.set_trace() if search.firstname == None: search.firstname = u'' if search.surname == None: search.surname = u'' if len(search.firstname) == 0 and len(search.surname) == 0: raise zope.interface.Invalid( u"""Enter firstname and/ or surname.""") result of my Code: TypeError: tuple indices must be integers Hi, can you please include a complete traceback to see where the exception occurres? -- 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
[Zope3-Users] how to use invariant/validator? (z3c.form=1.6 and z3c.formui=1.3)
Hi, I want to use an invariant-check in an analogous manner like it is described at the end of the message. There is answered that the bug is fixed, but the same causes are still active. I'm using z3c.form=1.6 and z3c.formui=1.3 What seems to be the trouble now? my code: class IAddressSearch(zope.interface.Interface): ... @zope.interface.invariant def firstnameOrSurname( search ): #import pdb; pdb.set_trace() if search.firstname == None: search.firstname = u'' if search.surname == None: search.surname = u'' if len(search.firstname) == 0 and len(search.surname) == 0: raise zope.interface.Invalid( u"""Enter firstname and/or surname.""") result of my Code: TypeError: tuple indices must be integers message of Peter Piehler: On Monday 06 August 2007 22:23, Stephan Richter wrote: > On Sunday 05 August 2007 16:51, Peter Piehler wrote: > > recently I started working with Zope3 and z3c.form. > > The figures in the form should be checked, for instance that the first > > name and the surname are not identical. Therefore I write an > > invariant-check: > > > > class IAddress(zope.interface.Interface): > > """Address Interface""" > > ... > > @zope.interface.invariant > > def areEqual( address ): > > if address.firstname == address.surname: > > raise zope.interface.Invalid(u"first name and surname are > > same") > > > > I was expecting that the error would be shown in the form. > > Unfortunately, zope canceled the action: > > Hi Peter, > > just a quick note to tell you that I am not ignoring you. I have just > reproduced the problem in a doctest and I am fixing it now. I'll send > another mail, once I checked in a fix. Hi Peter, I just checked in a fix for this problem into z3c.form and z3c.formui. It actually turned out that I had to fix2 bugs and add a feature to solve the problem. But it should be working now. I did not make a new release yet, but will do that soon too. Please let me know, if it is still not working! Regards, Stephan Many thanks! Kai -- 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