CherryPy

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
第3行: 第3行:
 
http://www.cherrypy.org/
 
http://www.cherrypy.org/
  
 +
#apt-get install python2.4-cheetah
 +
 +
>>> from Cheetah.Template import Template
 +
>>> templateDef = """
 +
... <HTML>
 +
... <HEAD><TITLE>$title</TITLE></HEAD>
 +
... <BODY>
 +
... $contents
 +
... ## this is a single-line Cheetah comment and won't appear in the output
 +
... #* This is a multi-line comment and won't appear in the output
 +
...    blah, blah, blah
 +
... *#
 +
... </BODY>
 +
... </HTML>"""
 +
>>> nameSpace = {'title': 'Hello World Example', 'contents': 'Hello World!'}
 +
>>> t = Template(templateDef, searchList=[nameSpace])
 +
>>> print t
 
==User==
 
==User==
 
*http://reddit.com/
 
*http://reddit.com/

2007年3月5日 (一) 19:06的版本

CherryPy is a pythonic, object-oriented HTTP framework.

http://www.cherrypy.org/

#apt-get install python2.4-cheetah 
>>> from Cheetah.Template import Template
>>> templateDef = """
... <HTML>
... <HEAD><TITLE>$title</TITLE></HEAD>
... <BODY>
... $contents
... ## this is a single-line Cheetah comment and won't appear in the output
... #* This is a multi-line comment and won't appear in the output
...    blah, blah, blah 
... *#
... </BODY>
... </HTML>"""
>>> nameSpace = {'title': 'Hello World Example', 'contents': 'Hello World!'}
>>> t = Template(templateDef, searchList=[nameSpace])
>>> print t

User

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱