[Zope] KeyError when running example from Zope Book

Mark Lilly marq@europa.com
Wed, 9 Jan 2002 06:36:05 -0000


Hi,
I'm new, so i hope this is the appropriate place.
When running through the example in Ch 12 of the Zope Book 
(http://www.zope.org/Members/michel/ZB/CustomZopeObjects.dtml) all is 
well until i add the Python Script to the add object.
I get the following error (the script is at the end of this note). 
Any thoughts?

Thanks,
mark

PS-it has happened on two different Windows machines.

____________________________

Error Type: KeyError
Error Value: parameters: id ,title, request

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 226, 
in zpublisher_exception_hook
    (Object: add)
  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: ZPythonScriptHTML_editAction)
  File C:\Program Files\Zope\lib\python\ZPublisher\Publish.py, line 
112, in call_object
    (Object: ZPythonScriptHTML_editAction)
  File C:\Program 
Files\Zope\lib\python\Products\PythonScripts\PythonScript.py, line 
197, in ZPythonScriptHTML_editAction
    (Object: add)
  File C:\Program 
Files\Zope\lib\python\Products\PythonScripts\PythonScript.py, line 
216, in ZPythonScript_edit
    (Object: add)
  File C:\Program 
Files\Zope\lib\python\Products\PythonScripts\PythonScript.py, line 
451, in write
    (Object: add)
KeyError: (see above)

_____________________________
      ## Script (Python) "add"
      ##parameters: id ,title, REQUEST=None
      ##
      """
      Copy the exhibit template to the calling folder
      """

      # Clone the template, giving it the new ID. This will be placed
      # in the current context (the place the factory was called from).
      exhibit=context.manage_clone(container.exhibitTemplate,id)

      # Change the clone's title
      exhibit.manage_changeProperties(title=title)

      # If we were called through the web, redirect back to the context
      if REQUEST is not None:
          try: u=context.DestinationURL()
          except: u=REQUEST['URL1']
          REQUEST.RESPONSE.redirect(u+'/manage_main?update_menu=1')