Changeset 1127 for branches/0.8(django)/PyLucid/tools/content_processors.py
- Timestamp:
- 06/29/07 16:05:08 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/0.8(django)/PyLucid/tools/content_processors.py
r1101 r1127 1 #!/usr/bin/python 2 # -*- coding: UTF-8 -*- 1 3 2 4 """ … … 93 95 94 96 95 def render_string_template(template, context): 96 """ 97 Render a string-template with the given context 98 """ 99 context = Context(context) 100 template = Template(template) 101 html = template.render(context) 102 return html 103 104 def render_template(content, global_context, local_context={}): 97 def render_string_template(content, context): 105 98 """ 106 99 Render a template. 107 1. put all local context items in the global context108 2. render with the merged context109 Note:110 - The local_context are content for a internal page.111 - We merged the local- and global-context together, so every internal112 page can display something from the global context, like page name...113 100 """ 114 global_context.update(local_context) 115 116 html = render_string_template(content, global_context) 117 101 context2 = Context(context) 102 template = Template(content) 103 html = template.render(context2) 118 104 return html