Using Zope Page Templates for forms (tabs of products)
I have a product for which I am adding another tab, or lable or whatever you call it, that is, I added a dict to manage_options. Now, what I'm doing in fact, is turning a script and a template I did to a tab to integrate it in the product. I've done everything with zpt (I try to avoid dtml) ... Congratulations ;-)
<dtml-var manage_page_header> ... <dtml-var manage_tabs> ... and <dtml-var manage_page_footer> in ZPT. This is described in: http://www.zope.org/Members/Zen/howto/ZPT_management
<dtml-with "_(management_view='Bounce')"> For this, you will have to pass a parameter to the template like:
from Products.PageTemplates.PageTemplateFile import PageTemplateFile _myTemplate=PageTemplateFile('zpt/myTemplateName',globals()) 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') Then you can do this on zpt: <div tal:define="management_view options/management_view"> Do something here </div>
And how do I make a call similar to this: DTMLFile('dtml/manage_bounceForm', globals()) See above.
Regards, Josef _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus
-----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@pupeno.com - http://www.pupeno.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBHkjpfW48a9PWGkURAvkrAJwKn1De5a1ECI6ANYQlkpSlevC3WACgg8gI LdjR1hqMUqW86Iuz5yWUULQ= =XnTn -----END PGP SIGNATURE-----
participants (2)
-
Josef Albert Meile -
Pupeno