| 1 |
Hello! |
| 2 |
|
| 3 |
I'm pleased to announce version 3.4.0, the final release |
| 4 |
of branch 3.4 of CheetahTemplate3. |
| 5 |
|
| 6 |
|
| 7 |
What's new in CheetahTemplate3 |
| 8 |
============================== |
| 9 |
|
| 10 |
Bug fixes: |
| 11 |
|
| 12 |
- Fixed ``ImportHooks``: it must raise ``ModuleNotFoundError`` |
| 13 |
instead of ``ImportError``. |
| 14 |
|
| 15 |
- Fixed absolute import in ``ImportHooks`` under Python 3. |
| 16 |
|
| 17 |
- Use ``cache_from_source`` in ``ImportManager`` to find out |
| 18 |
``.pyc``/``.pyo`` byte-code files. |
| 19 |
|
| 20 |
- Fixed unmarshalling ``.pyc``/``.pyo`` byte-code files |
| 21 |
in ``ImportManager``. |
| 22 |
|
| 23 |
- Fixed ``Template.webInput``: Use ``urllib.parse.parse_qs`` |
| 24 |
instead of ``cgi.FieldStorage``; Python 3.13 dropped ``cgi``. |
| 25 |
|
| 26 |
- Fixed ``_namemapper.c``: Silent an inadvertent ``TypeError`` exception |
| 27 |
in ``PyMapping_HasKeyString`` under Python 3.13+ |
| 28 |
caused by ``_namemapper`` looking up a key in a non-dictionary. |
| 29 |
|
| 30 |
- Fixed ``_namemapper.c``: Silence ``IndexError`` when testing |
| 31 |
``name[attr]``. Some objects like ``re.MatchObject`` implement both |
| 32 |
attribute access and index access. This confuses ``NameMapper`` because |
| 33 |
it expects ``name[attr]`` to raise ``TypeError`` for objects that don't |
| 34 |
implement mapping protocol. |
| 35 |
|
| 36 |
- Fixed mapping test in ``NameMapper.py``: |
| 37 |
Python 3.13 brough a new mapping type ``FrameLocalsProxy``. |
| 38 |
|
| 39 |
- Fixed another ``RecursionError`` in ``ImportHooks`` under PyPy3. |
| 40 |
|
| 41 |
Tests: |
| 42 |
|
| 43 |
- tox: Run tests under Python 3.13. |
| 44 |
|
| 45 |
CI: |
| 46 |
|
| 47 |
- CI(GHActions): Switch to ``setup-miniconda``. |
| 48 |
|
| 49 |
- CI(GHActions): Run tests under Python 3.13. |
| 50 |
|
| 51 |
Build/release: |
| 52 |
|
| 53 |
- Rename sdist to lowercase; different build tools produce different case. |
| 54 |
This is important because stupid PyPI doesn't ignore sdists |
| 55 |
in different cases but also doesn't allow uploading. |
| 56 |
So we use single case, all lower. Also see PEP 625. |
| 57 |
|
| 58 |
|
| 59 |
What is CheetahTemplate3 |
| 60 |
======================== |
| 61 |
|
| 62 |
Cheetah3 is a free and open source (MIT) Python template engine. |
| 63 |
It's a fork of the original CheetahTemplate library. |
| 64 |
|
| 65 |
Python 2.7 or 3.4+ is required. |
| 66 |
|
| 67 |
|
| 68 |
Where is CheetahTemplate3 |
| 69 |
========================= |
| 70 |
|
| 71 |
Site: |
| 72 |
https://cheetahtemplate.org/ |
| 73 |
|
| 74 |
Download: |
| 75 |
https://pypi.org/project/CT3/3.4.0 |
| 76 |
|
| 77 |
News and changes: |
| 78 |
https://cheetahtemplate.org/news.html |
| 79 |
|
| 80 |
StackOverflow: |
| 81 |
https://stackoverflow.com/questions/tagged/cheetah |
| 82 |
|
| 83 |
Mailing lists: |
| 84 |
https://sourceforge.net/p/cheetahtemplate/mailman/ |
| 85 |
|
| 86 |
Development: |
| 87 |
https://github.com/CheetahTemplate3 |
| 88 |
|
| 89 |
Developer Guide: |
| 90 |
https://cheetahtemplate.org/dev_guide/ |
| 91 |
|
| 92 |
|
| 93 |
Example |
| 94 |
======= |
| 95 |
|
| 96 |
Install:: |
| 97 |
|
| 98 |
$ pip install CT3 # (or even "ct3") |
| 99 |
|
| 100 |
Below is a simple example of some Cheetah code, as you can see it's practically |
| 101 |
Python. You can import, inherit and define methods just like in a regular Python |
| 102 |
module, since that's what your Cheetah templates are compiled to :) :: |
| 103 |
|
| 104 |
#from Cheetah.Template import Template |
| 105 |
#extends Template |
| 106 |
|
| 107 |
#set $people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick', |
| 108 |
'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 'Hairy'}] |
| 109 |
|
| 110 |
<strong>How are you feeling?</strong> |
| 111 |
<ul> |
| 112 |
#for $person in $people |
| 113 |
<li> |
| 114 |
$person['name'] is $person['mood'] |
| 115 |
</li> |
| 116 |
#end for |
| 117 |
</ul> |