[Zope-CMF] Trouble Adding New Content Types Using Zclass

Kenneth Bolton kbolton@sputnik7.com
Thu, 12 Apr 2001 12:48:36 -0400


Hi all,

This list has been a great resource for me in beginning to understand how
the cmf works. I really appreciate the time the people at DC and elsewhere
are willing to spend helping clueless newbies like myself.

First, the good news. I got the PortalPoll to work from the tutorial, didn't
even have to rely on the zexp! So I followed the advice given here a few
days ago and tried to hack out something less complicated than the Poll for
my own edification and education.

Here is what I did:
I made a product, let's call it WasteManagement, and added a Zclass called
GarbageDump (base classes, I've tried it two ways, a:   ZObject,
_ZClass_for_CatalogTool, _ZClass_for_DiscussionTool,
_ZClass_for_PortalContent, _ZClass_for_PortalFolder,
_ZClass_for_WorkflowTool, _ZClass_for_DefaultDublinCoreImpl, and b: ZObject,
_ZClass_for_PortalContent, _ZClass_for_DefaultDublinCoreImpl). I used the
EditDone, EditForm, SearchableText, and view methods from PortalPoll, but
subbed my own properties in where applicable, e.g. DumpName (string),
DumpLocation (text), DumpContact (text), and DumpCapacity (int). I put a
modified addPortalClassPy in WasteManagement that reads:
 return 
context.manage_addProduct['WasteManagement'].GarbageDump.createInObjectManag
er(id,context.REQUEST)
I adjusted the Views (Edit, EditForm; View, View) and Define Permissions
(Create class instance = Add portal content) tabs.
I went into my portal_types and added my Factory based content type, filled
in the appropriate properties, tweaked the actions per the tutorial.

When I go into my folder in the portal instance, select new, and add a
GarbageDump, I get the following error, regardless of what ID I put in or
where I do it. (fyi, the one in the traceback below has the id
MyFirstGarbageDump)

I'm going to keep playing with it, pouring over the python source in an
attempt to figure out what is going on. If anyone can clue me, I'd very much
appreciate it. The Traceback and error page are below.

Cheers,
Ken

Error Type:

!


Cannot change the id of this object

Error Value: None

Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.

For more detailed information about the error, please refer to the HTML
source for this page.

If the error persists please contact the site maintainer. Thank you for your
patience.


Traceback (innermost last):
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publis
h.py, line 222, in publish_module
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publis
h.py, line 187, in publish
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
    (Object: Traversable)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publis
h.py, line 171, in publish
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/mapply
.py, line 160, in mapply
    (Object: invokeFactory)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publis
h.py, line 112, in call_object
    (Object: invokeFactory)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Products/CMFCore/
PortalFolder.py, line 368, in invokeFactory
    (Object: Traversable)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Products/CMFCore/
TypesTool.py, line 714, in constructContent
    (Object: Traversable)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Products/CMFCore/
TypesTool.py, line 473, in constructInstance
    (Object: ElementWithAttributes)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Shared/DC/Scripts
/Bindings.py, line 324, in __call__
    (Object: addPortalClassPy)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Shared/DC/Scripts
/Bindings.py, line 353, in _bindAndExec
    (Object: addPortalClassPy)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Products/PythonSc
ripts/PythonScript.py, line 336, in _exec
    (Object: addPortalClassPy)
    (Info: ({'script': <PythonScript instance at 8b480d8>, 'context':
<FactoryDispatcher instance at 84507c8>, 'container': <FactoryDispatcher
instance at 84507c8>, 'traverse_subpath': []}, ('MyFirstGarbagedump',), {},
None))
  File Script (Python), line 2, in addPortalClassPy
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/ZClasses/ZClass.p
y, line 522, in createInObjectManager
    (Object: GarbageDump)
  File 
/home/dstengle/build/zope/Zope-2.3.0-linux2-x86/lib/python/Products/CMFCore/
utils.py, line 127, in _setId
    (Object: Traversable)