Skip to main content

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.

Release files for pyctpp2 0.12.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyctpp2 0.12.2
File Size Uploaded
pyctpp2-0.12.2.tar.gz 73.2 kB Details

Release files / pyctpp2-0.12.2.tar.gz

Download URL pyctpp2-0.12.2.tar.gz
Size 73.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f654280a4687d92c738575265737e58e82e4cb9dfeb3c6596b5ce9137ae32951
BLAKE2b-256 checksum
How to use checksums
f4c59f4d883ad0d0e516a896e8fa5f69cae3932366bf2d67a001ffe7a42d23c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.12.2 This release

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.10.0

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page