[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Page Templates

nobody@nowhere.com nobody@nowhere.com
Tue, 03 Sep 2002 15:38:39 -0400

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


      The action script can do all kinds of things. It can validate
      input, handle errors, send email, and more.  Here's a sketch of
      how to validate input with a script::

        ## Script (Python) "action"
        if not context.validateData(request):
            # if there's a problem return the form page template
            # along with an error message
            return context.formTemplate(error_message='Invalid data')

        # otherwise return the thanks page
        return context.responseTemplate()

        % Anonymous User - Apr. 29, 2002 4:14 pm:
         Whats the differnce between using "container.", above, "context." as in this example, and "here." as at the
         beginning of this chapter?

        % Anonymous User - Sep. 3, 2002 3:38 pm:
         As far as I am aware (dealing with ZOPE only for some days):
         - 'container' refers to the folder, which holds the python script (the root from where it is aquired)
         - 'context' is the folder, from which the script is called (possibly aquiring it from some parent folder)
         - 'here' is equivalent to 'context', being used in page templates instead of python scripts