Re: [Zope] Executing a text file as a ZPT from a product
(Sun, May 03, 2009 at 09:26:57AM +0200) Jakob Schou Jensen wrote/schrieb/egrapse: > Im am writing a product and would like to include ZPT's as part of the > product. Is there a way that I can evaluate a piece of text (preferrably > stored as a text file in the product folder) as a ZPT? Yes of course you can - and about every guide on writing your own product shows you how to do it. For example just look at my BetaBoring sample product: http://papakiteliatziar.gr/BetaBoring What you do is use PageTemplateFile: from Products.PageTemplates.PageTemplateFile import PageTemplateFile ... _www= os.path.join(os.path.dirname(__file__), 'www') ... index_zpt = PageTemplateFile(_www+'/index.zpt', globals()) Regards, Sascha ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Executing a text file as a ZPT from a product
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jakob Schou Jensen wrote: > Im am writing a product and would like to include ZPT's as part of the > product. Is there a way that I can evaluate a piece of text (preferrably > stored as a text file in the product folder) as a ZPT? Something like: from App.Common import package_home from OFS.SimpleItem import SimpleItem from Products.PageTemplates.PageTemplateFile import PageTemplateFile class MyClass(SimpleItem): some_name = PageTemplateFile('some_name.pt', package_home(globals()) Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design"http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJ/gCE+gerLs4ltQ4RAjlXAKC02WUqOT0kiPOBTbjHKv9GFIRPIQCfTIw8 YrYRr+irI11VLP9h6iJ+ps0= =mOID -END PGP SIGNATURE- ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Executing a text file as a ZPT from a product
On 03.05.09 09:26, Jakob Schou Jensen wrote: > Im am writing a product and would like to include ZPT's as part of the > product. Is there a way that I can evaluate a piece of text > (preferrably stored as a text file in the product folder) as a ZPT? "evaluate"? In general: ZPT and PythonScripts are stricted and can not access the filesystem - except through unrestricted Python code ("trusted code") e.g. through a browser view or an external method or product code. -aj begin:vcard fn:Andreas Jung n:Jung;Andreas org:ZOPYX Ltd. & Co. KG adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany email;internet:i...@zopyx.com title:CEO tel;work:+49-7071-793376 tel;fax:+49-7071-7936840 tel;home:+49-7071-793257 x-mozilla-html:FALSE url:www.zopyx.com version:2.1 end:vcard ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Executing a text file as a ZPT from a product
Im am writing a product and would like to include ZPT's as part of the product. Is there a way that I can evaluate a piece of text (preferrably stored as a text file in the product folder) as a ZPT? Thanks, Jakob Schou Jensen ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )