[Zope-CMF] Problem creating products programatically

Josef Albert Meile jmeile@hotmail.com
Wed, 03 Oct 2001 07:45:56 -0000


I am having the following error message when I try to view an object 
which has been created programatically:

Begin of the error-->

Error Type: KeyError
Error Value: 

----------------------------------------------------------------------

Troubleshooting Suggestions

This resource may be trying to reference a nonexistent object or 
variable . 
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 /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 
223, in publish_module
  File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 
187, in publish
  File /usr/local/Zope-2.3.0/lib/python/Zope/__init__.py, line 221, 
in zpublisher_exception_hook
    (Object: DynamicType)
  File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 
171, in publish
  File /usr/local/Zope-2.3.0/lib/python/ZPublisher/mapply.py, line 
160, in mapply
    (Object: view)
  File /usr/local/Zope-2.3.0/lib/python/ZPublisher/Publish.py, line 
112, in call_object
    (Object: view)
  File /usr/local/Zope-2.3.0/lib/python/OFS/DTMLMethod.py, line 189, 
in __call__
    (Object: view)
  File /usr/local/Zope-
2.3.0/lib/python/DocumentTemplate/DT_String.py, line 540, in __call__
    (Object: view)
  File /usr/local/Zope-2.3.0/lib/python/DocumentTemplate/DT_Util.py, 
line 339, in eval
    (Object: getElement({'00':'Nicht 
spezifiziert','01':'Architektur','02':'Biotechnologie - Pharmazie - 
Chemie','03':'Consulting - Beratung','04':'Hardware - 
Computer','05':'Herstellung - Produktion - 
Automotive','06':'Ingenieurwesen','07':'IT','08':'Software - 
Computer','09':'Telekommunikation'},area))
    (Info: getElement)
  File <string>, line 0, in ?
  File /usr/local/Zope-
2.3.0/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__
    (Object: getElement)
  File /usr/local/Zope-
2.3.0/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in 
_bindAndExec
    (Object: getElement)
  File /usr/local/Zope-
2.3.0/lib/python/Products/PythonScripts/PythonScript.py, line 336, in 
_exec
    (Object: getElement)
    (Info: ({'script': <PythonScript instance at 8eee0d0>, 'context': 
<FullTimeJobClass instance at 8e9b3f0>, 'container': 
<FullTimeJobClass instance at 8e9b3f0>, 'traverse_subpath': []}, 
({'09': 'Telekommunikation', '08': 'Software - 
Computer', '05': 'Herstellung - Produktion - 
Automotive', '04': 'Hardware - 
Computer', '07': 'IT', '06': 'Ingenieurwesen', '01': 'Architektur', '0
0': 'Nicht spezifiziert', '03': 'Consulting - 
Beratung', '02': 'Biotechnologie - Pharmazie - Chemie'}, ''), {}, 
None))
  File Script (Python), line 2, in dictionaryElement
KeyError: (see above)

End of the error-->

I don't have this problem when I create the object from the portal 
interface. I guess the problem could be the way that I am using to 
create the objects or the location of the method getElement. This is 
the code I am using to create the object:

context.portal_types.constructContent(type_name='FullTimeJob',
                                      container=container,
                                      id='test')

Does somebody know what I am doing wrong?
Where should I put the method getElement?

My last question is:
After creating the object programatically, how can I call its 
editForm immediately?

Thanks in advance.