当前位置: 首页>>代码示例>>Python>>正文


Python Template.id方法代码示例

本文整理汇总了Python中Cheetah.Template.Template.id方法的典型用法代码示例。如果您正苦于以下问题:Python Template.id方法的具体用法?Python Template.id怎么用?Python Template.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cheetah.Template.Template的用法示例。


在下文中一共展示了Template.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import id [as 别名]
 def get(self, id):
     nickname = "[email protected]"
     wk = Workspace.get_by_id(int(id))
     if not wk:
         self.response.out.write("No such workspace")
         return
     
     user = users.get_current_user()
     if user:
         nickname = user.nickname()
         if wk.user.google_id != user.user_id() and not wk.demo:
             self.response.out.write("Not your workspace, %s" % nickname)
             return
     
     if not user and not wk.demo:
         self.redirect(users.create_login_url(self.request.uri))
     else:
         path = 'templates/workspace.html'
         template = Template(file=path)
         template.user = nickname
         template.logout_url = users.create_logout_url("/")
         template.wk = Workspace.get_by_id(int(id))
         template.id = id
         template.indent_strings = workspace.indent_strings
         template.indent_styles = workspace.indent_styles
         template.font_sizes = workspace.font_sizes
         template.font_faces = workspace.font_faces
         template.encodings = workspace.encodings
         template.sample_stylesheets = css.sample_stylesheets
         self.response.out.write(template)
开发者ID:jpsimons,项目名称:manglebracket,代码行数:32,代码来源:workspace.py

示例2: printer

# 需要导入模块: from Cheetah.Template import Template [as 别名]
# 或者: from Cheetah.Template.Template import id [as 别名]
def printer(id):
    t = Template(file='templates/print.html')
    data = db[id]
    t.id = id
    t.name = data['name']
    items = data['items']
    items += ['']
    n = int(math.floor(len(items) / 2.0))
    item_pairs = [(k, items[n + m]) for m, k in enumerate(items[:n])]

    t.item_list = item_pairs
    t.since = data['since']

    return str(t)
开发者ID:reox,项目名称:labellocal,代码行数:16,代码来源:labellocal.py


注:本文中的Cheetah.Template.Template.id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。