Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:ANN': 0.02; 'context': 0.04; 'lines.': 0.05; '(default': 0.07; 'pypy': 0.07; 'removes': 0.07; 'url:pypi': 0.08; 'python': 0.08; '-------': 0.09; 'i++)': 0.09; 'parameter.': 0.09; 'release.': 0.09; 'setup.py': 0.09; 'template.': 0.09; 'url:packages': 0.09; 'output': 0.10; '2.7': 0.13; '1.7': 0.16; '3.2.': 0.16; '\\n\\': 0.16; 'jython': 0.16; 'preprocessor': 0.16; 'skip:# 30': 0.16; 'subject:engine': 0.16; 'sudo': 0.16; 'url:tar': 0.16; '{})': 0.16; 'examples': 0.16; 'language': 0.16; 'converted': 0.18; 'simpler': 0.18; "user's": 0.18; 'template': 0.19; 'later': 0.19; 'received:209.85.212.46': 0.23; 'received:mail- vw0-f46.google.com': 0.23; 'changed': 0.23; 'converts': 0.23; 'enhancements': 0.23; 'optional': 0.23; 'pair': 0.23; 'sender:addr:gmail.com': 0.24; 'cache': 0.24; 'specify': 0.24; 'django': 0.25; 'code.': 0.26; 'code': 0.26; 'function': 0.27; 'import': 0.27; '(see': 0.28; 'message-id:@mail.gmail.com': 0.29; 'class': 0.29; 'example': 0.29; "skip:' 10": 0.29; 'lines': 0.30; 'pattern': 0.30; 'tar': 0.30; 'changes': 0.30; 'app': 0.31; 'received:209.85.212': 0.33; 'it.': 0.33; 'file': 0.34; 'skip:# 10': 0.34; '---------': 0.34; 'to:addr:python-list': 0.35; 'google': 0.35; 'url:python': 0.35; 'install': 0.35; 'beginning': 0.36; 'partial': 0.37; 'run': 0.37; 'received:google.com': 0.37; 'skip:- 40': 0.38; 'received:209.85': 0.38; 'format': 0.38; 'should': 0.38; 'files': 0.39; 'skip:d 40': 0.39; 'url:org': 0.39; 'format.': 0.39; 'url:source': 0.39; 'received:209': 0.39; 'change': 0.40; 'to:addr:python.org': 0.40; 'release': 0.40; 'easy': 0.60; 'follow': 0.61; 'your': 0.61; 'virus: To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 171 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329447603 news.xs4all.nl 6899 [2001:888:2000:d::a6]:34878 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20535 I released pyTenjin 1.1.0. http://pypi.python.org/pypi/Tenjin/ http://www.kuwata-lab.com/tenjin/ Overview of pyTenjin -------------------- * Very fast: about 10 times faster than Django template engine * Easy to learn: no need to learn template-original language * Full-featured: nestable layout template, partial template, preprocessing, etc. * Lightweight: only 2000 lines of code and very fast to import. * Google App Engine supported Documents --------- * User's Guide http://www.kuwata-lab.com/tenjin/pytenjin-users-guide.html * Examples http://www.kuwata-lab.com/tenjin/pytenjin-examples.html * CHANGES http://www.kuwata-lab.com/tenjin/pytenjin-CHANGES.txt Install ------- $ sudo easy_install Tenjin Or: $ wget http://pypi.python.org/packages/source/T/Tenjin/Tenjin-1.1.0.tar.gz $ tar xzf Tenjin-1.1.0.tar.gz $ cd Tenjin-1.1.0/ $ sudo python setup.py install Example ------- ## views/example.pyhtml

${title}

${item}
## main.py import tenjin #tenjin.set_template_encoding('utf-8') # optional (default 'utf-8') from tenjin.helpers import * from tenjin.html import * engine = tenjin.Engine(path=['views']) context = {'title': 'Example', 'items': ['Haruhi', 'Mikuru', 'Yuki'] } output = engine.render('example.pyhtml', context) print(output) ## output $ python main.py

Example

Haruhi
Mikuru
Yuki
Enhancements and Changes in this release ---------------------------------------- (See http://www.kuwata-lab.com/tenjin/pytenjin-CHANGES.txt for details.) * [Change] !! IMPORTANT!! Default cache file format is changed from marshal format to text format. You should remove all cache files to use this release. * [Enhance] Embedded pattern '${}' and '#{}' can contain pair of '{' and '}'. ::

${foo({'x':1})}

# OK

${foo({}+{}+{})}

# OK

${foo({'x':{'y':1}})}

# NG * [Enhance] New preprocessing mechanism. You can specify your own preprocessor class by 'pp' parameter. * [Enhance] Add 'TrimPreprocessor' which removes spaces ad the beginning of lines. You can reduce size of output by it. * [Enhance] Add 'PrefixedLinePreprocessor' which converts ':: ...' into ''. You may like ':: ...' because it is simpler than ''. * [Enhance] Add 'JavaScriptPreprocessor' class which enables you to embed client-side javascript template code into server-side template. For example::
#{i} ${items[i]}
will be converted into::
by JavaScriptPreprocessor. Notice that you should embed 'tenjin.JS_FUNC' to run client-side code. How to use it:: pp = [ tenjin.JavaScriptPreprocessor() ] engine = tenjin.Engine(pp=pp) output = engine.render('example.pyhtml', {}) print(html) * [Enhance] Now supports Jython 2.5.2. (thanks to Lars Hupfeldt Nielsen) * [Enhance] Now supports PyPy 1.7 or later officially. * [Change] Template#convert() now converts "\r\n" into "\\r\n". This is necessary to follow change of language specification on Python 2.7 and 3.2. Have fun! -- makoto kuwata