[Zope-CMF] Constructing portal folder based ZClass programmatically
Antwan Reijnen
antwan@dexus.nl
Wed, 08 May 2002 11:51:27 +0200
Hi all,
I send this message again, because I forgot to include the error traceback (thanks Dieter!).
I use Zope 2.3.3, and CMF 1.2.
I created a ZClass based on Portal Folder. I used two different methods in a Python Script to add an instance to a portal folder in a portal, and both failed with the same error.
The two methods do however create other portal-content-based ZClasses instances correctly!
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
The second method, which also works correctly for normal portalcontent based ZClasses, goes like this:
context.portal_types.constructContent(type_name='PortalFolderBasedZClassContentType', container=myPortalFolderInWhichTheContentGoes, id='my_folder_based_content')
It also complains:
Error Type: TypeError
Error Value: argument id was ommitted
It seems that the id-parameter is swallowed somewhere in the proces. Anyone who experienced the same problems?
I hereby attatch the traceback for more clues.
Any clues will be appreciated.
TIA, Antwan.
Traceback (innermost last):
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 223, in publish_module
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 187, in publish
File C:\Program Files\Zope\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook
(Object: Traversable)
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 171, in publish
File C:\Program Files\Zope\lib\python\ZPublisher\mapply.py, line 160, in mapply
(Object: addTest)
File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 112, in call_object
(Object: addTest)
File C:\Program Files\Zope\lib\python\Shared\DC\Scripts\Bindings.py, line 324, in __call__
(Object: addTest)
File C:\Program Files\Zope\lib\python\Shared\DC\Scripts\Bindings.py, line 354, in _bindAndExec
(Object: addTest)
File C:\Program Files\Zope\lib\python\Products\PythonScripts\PythonScript.py, line 336, in _exec
(Object: addTest)
(Info: ({'script': <PythonScript instance at 029E32D0>, 'context': <CMFSite instance at 024CFD00>, 'container': <CMFSite instance at 024CFD00>, 'traverse_subpath': []}, (), {}, None))
File Script (Python), line 9, in addTest
File C:\Program Files\Zope\lib\python\Products\CMFCore\PortalFolder.py, line 338, in invokeFactory
(Object: Traversable)
File C:\Program Files\Zope\lib\python\Products\CMFCore\TypesTool.py, line 712, in constructContent
(Object: Traversable)
File C:\Program Files\Zope\lib\python\Products\CMFCore\TypesTool.py, line 439, in constructInstance
(Object: ElementWithAttributes)
File C:\Program Files\Zope\lib\python\Shared\DC\Scripts\Bindings.py, line 324, in __call__
(Object: CMFQCVFolder_add)
File C:\Program Files\Zope\lib\python\Shared\DC\Scripts\Bindings.py, line 354, in _bindAndExec
(Object: CMFQCVFolder_add)
File C:\Program Files\Zope\lib\python\Products\PythonScripts\PythonScript.py, line 336, in _exec
(Object: CMFQCVFolder_add)
(Info: ({'script': <PythonScript instance at 02DCB520>, 'context': <FactoryDispatcher instance at 02A1B480>, 'container': <FactoryDispatcher instance at 02A1B480>, 'traverse_subpath': []}, ('qcv',), {}, None))
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)
Antwan Reijnen
DEXUS New Media
Metropole Office
Laan van Meerdervoort 70
2517 AN Den Haag
Tel 070-3114800
Fax 070-3656279
http://www.dexus.nl
DEXUS New Media maakt deel uit van de Metropole IT Group
http://www.metropole-it.nl
ICQ#: 7916222