Feedback to user with PageTemplateFile()
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm doing this in a Zope product to have tool that is in a tab of that product and where the templates are made with zpt: manage_importForm = PageTemplateFile('www/manage_importForm', globals()) def manage_import(self, REQUEST): message="Work done" return self.manage_importForm(REQUEST) Now, my question is, how do I get the variable message to be usable in the template www/manage_importForm ? Do I pass it as a variable for manage_importForm() ? and PageTemplateFile() ? and how do I use it in the template. Thanks. - -- Pupeno: pupeno@pupeno.com - http://www.pupeno.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBHTb/fW48a9PWGkURAhZvAJ9EretenYewYFUGe4OhqJ5Ft/OVrACfUWzh eME9I8zQcAclQxVhRoerSOM= =LN0+ -----END PGP SIGNATURE-----
Pupeno wrote at 2004-8-13 18:47 -0300:
... manage_importForm = PageTemplateFile('www/manage_importForm', globals()) def manage_import(self, REQUEST): message="Work done" return self.manage_importForm(REQUEST)
Now, my question is, how do I get the variable message to be usable in the template www/manage_importForm ?
You pass it as argument. Passed in arguments are available via the predefined "options" variable. Read the ZPT specification for details... Note: usually, there is not need to pass "REQUEST" to a PageTemplate as it provides access to it via the predefined variable "request". -- Dieter
Dieter Maurer wrote:
Pupeno wrote at 2004-8-13 18:47 -0300:
... manage_importForm = PageTemplateFile('www/manage_importForm', globals()) def manage_import(self, REQUEST): message="Work done" return self.manage_importForm(REQUEST)
Now, my question is, how do I get the variable message to be usable in the template www/manage_importForm ?
You pass it as argument.
Could you please give an example
Passed in arguments are available via the predefined "options" variable. Read the ZPT specification for details...
Note: usually, there is not need to pass "REQUEST" to a PageTemplate as it provides access to it via the predefined variable "request".
Will Smith wrote at 2004-9-7 13:13 -0400:
Dieter Maurer wrote:
Pupeno wrote at 2004-8-13 18:47 -0300:
... manage_importForm = PageTemplateFile('www/manage_importForm', globals()) def manage_import(self, REQUEST): message="Work done" return self.manage_importForm(REQUEST)
Now, my question is, how do I get the variable message to be usable in the template www/manage_importForm ?
You pass it as argument.
Could you please give an example
You must already know how to pass arguments, don't you? Here is an example: return self.manage_importForm(message=message) It is different from the way you expected it?
Passed in arguments are available via the predefined "options" variable. Read the ZPT specification for details...
I already told you here how you access this argument inside the template -- and where you have to look for further information, should the statement be inadequate.... Don't ask me for an example how to access it inside the template! -- Dieter
participants (3)
-
Dieter Maurer -
Pupeno -
Will Smith