[Zope-CMF] Constructing portal folder based ZClass programmatically
Dieter Maurer
dieter@handshake.de
Wed, 8 May 2002 23:02:22 +0200
Antwan Reijnen writes:
> ...
> I created a ZClass based on Portal Folder....
> ...
> The first method goes like this and as said, works correctly for my normal portalcontent based ZClasses:
>
> myPortalFolderInWhichTheContentGoes.invokeFactory
> (type_name='PortalFolderBasedZClassContentType', id='my_folder_based_content')
>
> It complains:
>
> Error Type: TypeError
> Error Value: argument id was ommitted
> ...
>
> Traceback (innermost last):
> ...
> File Script (Python), line 4, in CMFQCVFolder_add
> File C:\Program Files\Zope\lib\python\ZClasses\ZClass.py, line 524, in createInObjectManager
> (Object: CMFQCVFolder)
> File C:\Program Files\Zope\lib\python\ZPublisher\mapply.py, line 155, in mapply
> (Object: CMFQCVFolder)
> File C:\Program Files\Zope\lib\python\ZPublisher\mapply.py, line 93, in default_missing_name
> TypeError: (see above)
The traceback tells you:
Your "CMFQCVFolder_add" is called.
In line 4, it calls "createInObjectManager".
A look at its source ("ZClasses/ZClass.py" line 524) reveals, that
it calls "mapply(self._zclass_,(),REQUEST)".
The error tells, "id" is missing.
"REQUEST" is the second argument passed to "createInObjectManager".
This second argument (i.e. "REQUEST") lacks an "id" key.
Up to you to find out, why...
Dieter