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

webmaster at zope.org webmaster at zope.org
Mon Jan 26 10:24:38 EST 2004


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

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

    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.

      % Anonymous User - Jan. 26, 2004 10:24 am:
       With Zope version 2.6.2 works 'Paste' fine. (no need to remove lines)



More information about the ZDP mailing list