/ Hathaway Weblog / Zope 3 a la carte: page templates

Shane :: Zope :: October 05, 2004 # Zope 3 a la carte: page templates

My first experiment in using Zope 3 as a library went very well. I wanted to use the Zope Page Templates (ZPT) implementation in Zope 3 outside the Zope 3 framework. No problem!

from zope.pagetemplate import pagetemplate

text = '''\
<html>
<head>
<title tal:content="options/title">Title goes here</title>
</head>
<body>
<h1 tal:content="options/title">Title goes here</h1>
<ul>
<li tal:repeat="bullet options/bullets" tal:content="bullet">item</li>
</ul>
</body>
</html>
'''


def main():
    
pt = pagetemplate.PageTemplate()
    
pt.pt_edit(text, 'text/html')
    
print pt(title='Success!', bullets=[1,2,3])

if __name__ == '__main__':
    
main()

Comments

Ivo van der Wijk (December 04, 2004 05:21)

As far as I know, Five (Zope3 for Zope2) uses Zope3 as a library as well. Nifty :)

Chris (September 16, 2005 12:43)

While your are talking about Zope 3, I thought I would mention that I am aware of this "TAL outside of Zope" project from the people at tummy.com:

JotWEB: http://jotweb.tummy.com/

No further comments may be added.

2 Nephi 2:25 (Click below to fill in the blanks.)
Your browser is not able to display the scripture fill-in program. To see it, enable Javascript or use Mozilla 1.0 or better.

Church: lds scriptures provident games pearls kzion shiblon film chancellor gateway cumorah byutv happiness nephi
Zope: freezope org com zen labs newbies zettai warnes
Python: home pyzine daily icanprogram
Genealogy: cyndi
Weblogs: jeffrey paul jon joel another-shane guido barry jeremy windley chrism zac
News: quakes lwn dc weather deseret zeitgeist softwarelivre
Zaurus: software developer
Tech: tango spintronics thin
Semantic: aaron sean
Reference: css rdf html4 javascript geckodom iecss emacs phrases acronyms
Reverse: advogato slashdot
Misc: gimp-savvy directory soda jokes shouldexist pdphoto