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

webmaster@zope.org webmaster@zope.org
Sat, 28 Sep 2002 23:47:27 -0400

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


      This form will call the *processPerson* script with one
      parameter, *person*. The *person* variable will have *fname*,
      *lname* and *age* attributes. Here's an example of how you might
      use the *person* variable in your *processPerson* script::

        ## Script (Python) "processPerson"
        " process a person record "
        full_name="%s %s" % (person.fname, person.lname)
        if person.age < 21:
            return "Sorry, %s. You are not old enough to adopt an aardvark." % full_name
        return "Thanks, %s. Your aardvark is on its way." % full_name

        % Anonymous User - Sep. 28, 2002 11:47 pm:
         Is it possible to pass the person parameter to your response template with something like
         request.set('person', person)? If not, how do you pass objects to the response template from a python script?