[Zope] Using Zope Page Templates for forms (tabs of products)

Pupeno pupeno at pupeno.com
Sat Aug 14 13:16:22 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday August 13 2004 16:48, Josef Albert Meile wrote:
> def myTemplate(self):
>   """Here some attributes are added to the template"""
>   _myTemplate._owner=None
>   #Adds the management_view attribute to the built-in variable "options"
>   return _myTemplate.__of__(self)(management_view='Bounce')
Can you elaborate that a bit more ? what is __of__ ? why did you make 
_ownner=None ?


> Then you can do this on zpt:
> <div tal:define="management_view options/management_view">
>   Do something here
> </div>
What about <p tal:content="options/management_view" /> ?

What I'm trying to do is this:
    security.declareProtected('Manage properties','manage_importForm')
    manage_importForm = PageTemplateFile('www/manage_importForm', globals())
    manage_importForm._owner = None

    security.declareProtected('Manage properties', 'manage_import')
    def manage_import(self, REQUEST):
	message="something"
        REQUEST.RESPONSE.setHeader('content-type', 'text/html')
        return self.manage_importForm.__of__(self)(message=message)

And in the template:

And when I try to access, I get the error:
Error Type: KeyError
Error Value: 'message'
What am I doing wrong ?
<div tal:define="message options/message">
</div>
- -- 
Pupeno: pupeno at pupeno.com - http://www.pupeno.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBHkjpfW48a9PWGkURAvkrAJwKn1De5a1ECI6ANYQlkpSlevC3WACgg8gI
LdjR1hqMUqW86Iuz5yWUULQ=
=XnTn
-----END PGP SIGNATURE-----


More information about the Zope mailing list