Skip to main content

Python interface to CTPP2 library.

Project description

Example of usage

Make template file hello.tmpl:

Foo: <TMPL_var foo.bar>
Spam: <TMPL_var foo[spam]>
Array:
    <TMPL_var array[0].key>
    <TMPL_var array[1]['key']>

Create Python script:

#!/usr/bin/env python

import pyctpp2

if __name__ == '__main__':
    engine = pyctpp2.Engine()

    template = engine.parse('hello.tmpl')

    result = template.render({
        'foo': { 'bar': 'baz' },
        'spam': 'bar',
        'array': [
            { 'key': 'first' },
            { 'key': 'second' } ]
    })

Check output:

Foo: baz
Spam: baz
Array:
    first
    second

See pydoc pyctpp2.Engine and pydoc pyctpp2.Template for more information.

CHANGES

0.12.2 (19.01.2012)

  • Fixed version.py.

0.12.1 (19.01.2012)

  • Fixed version.py.

0.12.0 (19.01.2012)

  • Updated documentation.

  • Fixed searching CTPP2 library.

  • Fixed support of Python 3.

  • Support CTPP2 library >= 2.8 version only.

0.11.2 (13.09.2011)

  • Fixed Restructed text syntax.

  • Updated documentation.

  • Fixed setup.py.

  • Fixed bug with empty language.

  • Updated build without cython.

0.11.1 (30.06.2011)

  • Fixed extract method ‘ctpp2’ for Babel.

0.11.0 (29.06.2011)

  • Added support of new CTPP2 gettext implementation.

  • Support CTPP2 library >= 2.7 version only.

0.10.0 (23.05.2011)

  • Added support of array/hash indirect calls (foo{bar} and foo[bar]).

  • Support CTPP2 library >= 2.6.16 version only.

0.9.10 (17.05.2011)

  • Added duplicate information about dicts for HASH_ELEMENT support.

0.9.9 (17.05.2011)

  • Fixed HASH_ELEMENT support.

0.9.8 (12.05.2011)

  • Fixed extract method ‘ctpp2’ for Babel.

0.9.7 (28.04.2011)

  • Fixed support of render params with types.LongType.

0.9.6 (19.04.2011)

  • Fixed extract method ‘ctpp2’ for Babel.

0.9.5 (19.04.2011)

  • Fixed build with Cython.

0.9.4 (19.04.2011)

  • Added extract method ‘ctpp2’ for Babel.

0.9.3 (15.04.2011)

  • Added support of i18n.

  • Fixed tests.

  • Changed Template and Engine API.

0.9.2 (28.03.2011)

  • Fixed installation by pip.

0.9.1 (13.01.2011)

  • Added COPYING.txt.

  • Added support of traversable objects.

  • Some bug fixes.

0.9.0 (11.01.2011)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyctpp2-0.12.2.tar.gz (73.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page