ANN: pyTenjin 0.8.0 - much faster template engine than Django

Discussion in 'Python' started by kwatch, Jun 6, 2009.

  1. kwatch

    kwatch Guest

    I have released pyTenjin 0.8.0
    http://www.kuwata-lab.com/tenjin/

    pyTenjin is the fastest template engine for Python.

    * Very fast (about 10 times faster than Django template engine)
    * Easy to learn (no need to learn template-original language)
    * Full-featured (layout template, partial template,
    preprocessing, ...)
    * Very small (only 1,200 lines, one file)
    * Goole AppEngine supported.
    http://www.kuwata-lab.com/tenjin/pytenjin-faq.html#faq-google-appengine



    Changes from 0.7.0
    ------------------

    * !!IMPORTANT!!
    HTML helper function 'tagattr()' is renamed to 'tagattrs()'.
    (Notice that new 'tagattr()' is added. See below.)

    * 'tagattrs()' is changed to add ' ' (space) at the first character.
    ex.
    (0.7.0) tagattr(klass='error') #=> 'class="error"'
    (0.7.1) tagattrs(klass='error') #=> ' class="error"'

    * 'tagattrs()' is changed to handle 'checked', 'selected', and
    'disabled' attributes.
    ex.
    >>> from tenjin.helpers.html import *
    >>> tagattrs(checked=True, selected='Y', disabled=1)

    ' checked="checked" selected="selected" disabled="disabled"'
    >>> tagattrs(checked=False, selected='', disabled=0)

    ''


    Bugfix
    ------

    * !!IMPORTANT!!
    Template caching is changed to keep template file's timestamp
    instead of create time of cached object. See
    http://groups.google.com/group/kuwa.../thread/a0d447c282fb383d#msg_de39557405c9b656
    for details. (Thanks Steve)


    Enhancements
    ------------

    * Add new HTML helper function 'tagattr()'.
    (Notice that 'tagattr()' in 0.7.0 is renamed into 'tagattrs()'.)
    ex.
    >>> from tenjin.helpers.html import *
    >>> tagattr('size', 20)

    ' size="20"'
    >>> tagattr('size', 0)

    ''
    >>> tagattr('size', 20, 'large')

    ' size="large"'
    >>> size = 20 # you can use tagattrs() instead of tagattr

    ()
    >>> tagattrs(size=(size and 'large'))

    ' size="large"'

    * Add new HTML helper function 'new_cycle()'.
    ex.
    >>> from tenjin.helpers.html import *
    >>> cycle = new_cycle('odd, 'even')
    >>> cycle()

    'odd'
    >>> cycle()

    'even'
    >>> cycle()

    'odd'
    >>> cycle()

    'even'

    * (experimental) Template converter is changed to add dummy if-
    statement
    when first Python statement is indented. (Thanks Steve)
    ex.
    $ cat ex.pyhtml
    <html>
    <body>
    <ul>
    <?py for item in items: ?>
    <li>${item}</li>
    <?py #end ?>
    </ul>
    </body>
    </html>
    $ pytenjin -sb ex.pyhtml
    _buf.extend(('''<html>
    <body>
    <ul>\n''', ));
    if True: ## dummy
    for item in items:
    _buf.extend((''' <li>''', escape(to_str(item)),
    '''</li>\n''', ));
    #end
    _buf.extend((''' </ul>
    </body>
    </html>\n''', ));

    * Update User's Guide and FAQ.


    Have fun!

    --
    regards,
    makoto kuwata
     
    kwatch, Jun 6, 2009
    #1
    1. Advertising

  2. kwatch

    Igor Katson Guest

    kwatch wrote:
    > I have released pyTenjin 0.8.0
    >

    Thanks for your project. I have used it a little, and there is a
    question to you.

    import tenjin
    from tenjin.helpers import *
    shared_cache = tenjin.GaeMemcacheCacheStorage()
    engine = tenjin.Engine(cache=shared_cache)

    1. Why should I import tenjin.helpers if I don't use the helpers in my code?
    2. Why does the code not work if I don't import the helpers?

    I think you should manage this issue inside the library.
     
    Igor Katson, Jun 17, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. makoto kuwata
    Replies:
    0
    Views:
    283
    makoto kuwata
    Feb 27, 2008
  2. kwatch
    Replies:
    0
    Views:
    309
    kwatch
    May 24, 2009
  3. kwatch
    Replies:
    0
    Views:
    283
    kwatch
    Jun 14, 2009
  4. Makoto Kuwata
    Replies:
    0
    Views:
    275
    Makoto Kuwata
    Jul 19, 2010
  5. Makoto Kuwata
    Replies:
    1
    Views:
    260
    Dhaivat Pandya
    Feb 22, 2011
Loading...

Share This Page