[Zope-CMF] ZClass Errors?

Carl Rendell cer@sol43.com
Wed, 17 Apr 2002 16:32:54 -0700


No replies on the list for this one, but incase others run into the 
same question and are hunting for the answer.

I found a reference to the ZClass FAQ How-To which gives part of 
the answer:

http://cmf.zope.org/Members/tseaver/how_tos/faq_howto/talkback/1013363771

This solution works.. Here's a step by step

1. Create your ZClass based product as usual

2. Delete the dtml based factory add method (zclassName_add)

3. Add a python script with the name of the add method you deleted 
(zclassName_add)

4. Modify the python script as follows -

    a. Parameter List = 'id'

    b. body of the script =

       container.zclassName.createInObjectManager(id,container.REQUEST)
       return id

That will make your ZClass based product function correctly. I have 
to say, this is quite a glaring deficiency in the 1.2 release as 
the target audience for the ZMI will not necessarily understand how 
to work with python scripts or understand why they need to do so. 
However, they are expected to have the ability to create 'safe 
products' based on a ZClass using the ZMI.

For the moment, I will be adding lines to this effect in our 
distributions of CMF 1.2 both in the README.txt and ISSUES.txt. I 
still expect to get comments like "why does the application create 
'bad' factory methods?" from clients.

Is this changed in CMF 1.3, or will we wait until the new component 
architecture? I'd like to give clients a good answer to their 
questions in this area instead of "thats just the way it is".

~C


> Subject: [Zope-CMF] ZClass Errors?
>
> This is interesting,
>
> Just started to work with ZClass based products in Zope 2.5.0/CMF
> 1.2, and after following the same process used with Zope 2.4.3/CMF
> 1.1, got this traceback when trying to create the first item.
> Anyone have ideas?
>
> Just to be clear, I created a standard installation of 2.5.0 and
> CMF 1.2 with no additional products what so ever. Clean install,
> and everything else seems to work perfectly.
>
> The ZClass is based on CMFDefault News Item
>
>
>
>
> Traceback (innermost last):
>    File /Applications/Zope/lib/python/ZPublisher/Publish.py, line
> 150, in publish_module
>    File /Applications/Zope/lib/python/ZPublisher/Publish.py, line
> 114, in publish
>    File /Applications/Zope/lib/python/Zope/__init__.py, line 158, in
> zpublisher_exception_hook
>      (Object: dev)
>    File /Applications/Zope/lib/python/ZPublisher/Publish.py, line
> 98, in publish
>    File /Applications/Zope/lib/python/ZPublisher/mapply.py, line 88,
> in mapply
>      (Object: invokeFactory)
>    File /Applications/Zope/lib/python/ZPublisher/Publish.py, line
> 39, in call_object
>      (Object: invokeFactory)
>    File
> /Applications/Zope/lib/python/Products/CMFCore/PortalFolder.py,
> line 335, in invokeFactory
>      (Object: dev)
>    File /Applications/Zope/lib/python/Products/CMFCore/TypesTool.py,
> line 701, in constructContent
>      (Object: portal_types)
>    File /Applications/Zope/lib/python/Products/CMFCore/TypesTool.py,
> line 430, in constructInstance
>      (Object: News Item)
>    File /Applications/Zope/lib/python/OFS/ObjectManager.py, line
> 215, in _getOb
>      (Object: dev)
> AttributeError: (see above)

Carl E. Rendell
Solution43
Information Distribution Consulting        |   "Ahhhh the power of
cer@sol43.com                              |    acquisition"  - Chef Z