building product from the doc
Hello happy Zopers, I'm currently trying to build a small & simple product, following (closely) advice from http://www.zope.org/Documentation/Books/ZDG/current/Products.stx The doc is clear and well done, but now I'm stuck on this : when I try to add some 'Candidat' (the meta_type of the product), I get from the ZMI a Zope Error Zope has encountered an error while publishing this resource. Error Type: TypeError Error Value: addForm() takes no arguments (1 given) etc... In the doc example, addForm is really defined with no argument, and I still don't see what knid of arg that ought to be. I'm still investigating. Grepping around current existing products doesn't help much since no installed product shows this very pattern (of an addForm function defined as in the zope doc). Thanks for your patience, Aurélien.
uhhh, from the comments (I read the doc with comments OFF), seems like the arg may be a dispatcher object... ok, YES, it solved the problem ! sorry for the inconvenience...
In the doc example, addForm is really defined with no argument, and I still don't see what knid of arg that ought to be. I'm still investigating. Grepping around current existing products doesn't help much since no installed product shows this very pattern (of an addForm function defined as in the zope doc).
Thanks for your patience,
Aurélien.
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Aurélien Campéas wrote at 2003-7-1 17:33 +0200:
I'm currently trying to build a small & simple product, following (closely) advice from http://www.zope.org/Documentation/Books/ZDG/current/Products.stx
The doc is clear and well done, but now I'm stuck on this : when I try to add some 'Candidat' (the meta_type of the product), I get from the ZMI a
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: TypeError Error Value: addForm() takes no arguments (1 given)
Your "addForm" definition does not define an argument but the context calls it with one. If "addForm" is a method, then almost surely "self" is missing. Unlike in other OO languages (as C++ and Java) Python methods must have an explicit (first) "self" argument representing the object instance the method is called for. Dieter
If "addForm" is a method, then almost surely "self" is missing. Unlike in other OO languages (as C++ and Java) Python methods must have an explicit (first) "self" argument representing the object instance the method is called for.
Thanks Dieter, I know this specific trait of python since I've been using it in non-zopish (purely pythonic) projects. But there it was not a method, really a function with a dispatcher argument. The correct function definition is in the comments of the doc. alas, the comments cripple the doc, but correct it in various ways. It would be cool if a merge happened some day... Aurélien.
participants (2)
-
Aurélien Campéas -
Dieter Maurer