[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Extending Zope

nobody@nowhere.com nobody@nowhere.com
Wed, 18 Sep 2002 14:36:43 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/CustomZopeObjects.stx#2-27

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

    Also notice that the action of the form is the *add* script.  Now
    paste the following body into the *add* script::

      ## 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')

      % rmg - Sep. 18, 2002 2:36 pm:
       The instructions are to 'Paste' in the code. If you paste in with the first three '##' lines, you get an
       error. Remove those lines and set the parameters in the 'Parameters' form field and all works fine.