[Zope] FAQ: How to add a ZClass

Ulrich Wisser u.wisser@publisher.de
Thu, 14 Jun 2001 14:35:07 +0200


Hello,

I know this is a FAQ but I didn't manage to add a ZClass
to a folder in DTML although I followed all steps in the How-To.
My new ZClass needs only to have an 'id', so I just go with
the default installation.
Here is what I do:

Create a product, name 'tip'
In the product create a ZClass name 'kingkong'
In folder /admin I have DTML Method 'addTip' which does

<dtml-with "manage_addProduct['tip']">
   <dtml-call "kingkong_add(_, REQUEST, NoRedir=3D1)">
</dtml-with>

When I call addTip?id=3D123

I get an NameError. Traceback says

Error Type: NameError
Error Value: kingkong

Traceback (innermost last):
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/ZPublisher/Publish.py,=
=20
line 222, in publish_module
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/ZPublisher/Publish.py,=
=20
line 187, in publish
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/Zope/__init__.py, line=
=20
221, in zpublisher_exception_hook
     (Object: Traversable)
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/ZPublisher/Publish.py,=
=20
line 171, in publish
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/ZPublisher/mapply.py,=20
line 160, in mapply
     (Object: dtTipp)
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/ZPublisher/Publish.py,=
=20
line 112, in call_object
     (Object: dtTipp)
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/OFS/DTMLMethod.py, line=
=20
172, in __call__
     (Object: dtTipp)
   File=20
/usr/local/Zope-2.2.5-linux2-x86/lib/python/DocumentTemplate/DT_String.py,=
=20
line 528, in __call__
     (Object: dtTipp)
   File=20
/usr/local/Zope-2.2.5-linux2-x86/lib/python/DocumentTemplate/DT_With.py,=20
line 146, in render
     (Object: _['Control_Panel'].Products.tip.kingkong)
   File=20
/usr/local/Zope-2.2.5-linux2-x86/lib/python/DocumentTemplate/DT_Util.py,=20
line 337, in eval
     (Object: kingkong_add(_, REQUEST, NoRedir=3D1))
     (Info: REQUEST)
   File <string>, line 0, in ?
   File /usr/local/Zope-2.2.5-linux2-x86/lib/python/OFS/DTMLMethod.py, line=
=20
172, in __call__
     (Object: kingkong_add)
   File=20
/usr/local/Zope-2.2.5-linux2-x86/lib/python/DocumentTemplate/DT_String.py,=
=20
line 528, in __call__
     (Object: kingkong_add)
   File=20
/usr/local/Zope-2.2.5-linux2-x86/lib/python/DocumentTemplate/DT_With.py,=20
line 133, in render
     (Object: kingkong.createInObjectManager(REQUEST['id'], REQUEST))
   File=20
/usr/local/Zope-2.2.5-linux2-x86/lib/python/DocumentTemplate/DT_Util.py,=20
line 337, in eval
     (Object: kingkong.createInObjectManager(REQUEST['id'], REQUEST))
     (Info: REQUEST)
   File <string>, line 0, in ?
NameError: (see above)


I really don't understand why? Any ideas?
Could you provide me with a working example?

Viele Gr=FC=DFe

Ulrich
--=20
Searchengine Know How  - Webpromotion - Optimization - Internal Search
World Wide Web Publisher, Ulrich Wisser, Odensvag 13, S-14571 Norsborg
http://www.publisher.de   Tel: +46-8-53460905    Fax: +46-8-534 609 06