-
Notifications
You must be signed in to change notification settings - Fork 0
/
news2.html
2144 lines (2115 loc) · 110 KB
/
news2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><no title> — Cheetah3 - The Python-Powered Template Engine</title>
<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Cheetah3 - The Python-Powered Template Engine</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/news2.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<dl class="docutils">
<dt>2.4.2 (February 8th, 2010)</dt>
<dd><ul class="first last simple">
<li>Fix issue where subclasses of Template failed to pick up attributes in the
searchlist</li>
<li>Remove old/outdated bundled memcached python client</li>
<li>Allow for #encoding directives to exist after a comment (i.e. not the first
line in a module)</li>
<li>Remove support for WebWare servlets (which caused significant performance
slowdowns on Mac OS X)</li>
<li>Old/stale code pruned in preparation for Python 3 support</li>
</ul>
</dd>
<dt>2.4.1 (December 19th, 2009)</dt>
<dd><ul class="first last simple">
<li>–quiet flag added to <cite>cheetah</cite> to silence printing to stdout (abbeyj)</li>
<li>Refactoring to minimize the amount of forked code for Python3 (rtyler)</li>
<li>Template.compile() will no longer create class names with numerous leading
underscores (rtyler; reported by Kirill Uhanov)</li>
<li>DirectiveAnalyzer (cheetah-analyze script) added to report directive usage in templates (rtyler)</li>
<li>Older LaTeX docs converted to rst for Sphinx (rtyler)</li>
<li>Prevent #raw blocks from evaluating $-placeholders and escaped strings (karmix0)</li>
<li>New tests added to verify PSP behavior and other untested internals (rtyler)</li>
</ul>
</dd>
<dt>2.4.0 (October 24th, 2009)</dt>
<dd><ul class="first last simple">
<li>Fix a major performance regression in Template.__init__()</li>
<li>More graceful handling of unicode when calling .respond() to render a template</li>
<li>Minor code updates</li>
<li>Update the default filter (thanks mikeb!)</li>
</ul>
</dd>
<dt>2.3.0 (October 24th, 2009) (loosely equivalent to 2.4.0)</dt>
<dd><ul class="first last simple">
<li>Fix a major performance regression in Template.__init__()</li>
<li>More graceful handling of unicode when calling .respond() to render a template</li>
<li>Minor code updates</li>
<li>Update the default filter (thanks mikeb!)</li>
</ul>
</dd>
<dt>2.2.2 (September 10th, 2009)</dt>
<dd><ul class="first last simple">
<li>Prevent _namemapper.c from segfaulting when PyImport_ImportModule fails for some reason (Bogdano Arendartchuk <<a class="reference external" href="mailto:debogdano%40gmail.com">debogdano<span>@</span>gmail<span>.</span>com</a>>)</li>
<li>Removal of the contrib/markdown module (in favor of a setuptools dependency)</li>
<li>Default setup.py to use setuptools by default, failing that, fall back to distutils</li>
<li>Improvements to setup.py to support building for Windows (thanks abbeyj!)</li>
<li>Improvements to C-based NameMapper for Windows</li>
<li>Fixes for a swath of unit tests on Windows</li>
<li>Re-enabling the EOL tests (whoops)</li>
<li>Fix for unicode/utf-8 dynamic compilation error (thanks mikeb!) (Test.Unicode.JBQ_UTF8_Test8)</li>
<li>0000010: [Templates] Failure to execute templates on Google App Engine (rtyler)</li>
<li>0000026: [Compiler] Support multiple inheritance (rtyler)</li>
</ul>
</dd>
<dt>2.2.1 (June 1st, 2009)</dt>
<dd><ul class="first last simple">
<li>0000020: [Templates] Builtin support for using Cheetah with Django (rtyler)</li>
<li>0000021: [Compiler] @static and @classmethod don’t properly define the _filter local (rtyler)</li>
<li>0000023: [Compiler] Update Template super calls to use super() (rtyler)</li>
<li>Update all references to communitycheetah.org to point back at cheetahtemplate.org</li>
</ul>
</dd>
<dt>2.2.0 (May 17th, 2009)</dt>
<dd><ul class="first last simple">
<li>Switch all internal representations of template code to unicode objects instead of str() objects</li>
<li>Convert unicode compiled template to an utf8 char buffer when writing to a file (Jean-Baptiste Quenot <<a class="reference external" href="mailto:jbq%40caraldi.com">jbq<span>@</span>caraldi<span>.</span>com</a>>)</li>
<li>0000011: [Templates] Calling a function with arguments calls the function with None (rtyler)</li>
<li>0000015: [Tests] Resolve test failures in ‘next’ branch (rtyler)</li>
<li>0000019: [Templates] Properly warn when joining unicode and non-unicode objects in DummyTransaction (rtyler)</li>
</ul>
</dd>
<dt>2.1.2 (May 5, 2009)</dt>
<dd><ul class="first last simple">
<li>0000006: [Templates] Support @staticmethod and @classmethod (rtyler)</li>
</ul>
</dd>
<dt>2.1.1 (April 16, 2009)</dt>
<dd><ul class="first last simple">
<li>Support __eq__() and __ne__() the way you might expect in src/Tools/RecursiveNull (patch suggested by Peter Warasin <<a class="reference external" href="mailto:peter%40endian.com">peter<span>@</span>endian<span>.</span>com</a>>)</li>
<li>Applied patch to avoid hitting the filesystem to get the file modification time everytime a #include directive is processed (Jean-Baptiste Quenot <<a class="reference external" href="mailto:jbq%40caraldi.com">jbq<span>@</span>caraldi<span>.</span>com</a>>)</li>
<li>Applied patch to fix some annoying cases when Cheetah writes to stderr instead of propagating the exception (Jean-Baptiste Quenot <<a class="reference external" href="mailto:jbq%40caraldi.com">jbq<span>@</span>caraldi<span>.</span>com</a>>)</li>
<li>Added KDE editor support</li>
<li>Applied patch to correct importHook behavior on Python 2.6 (reported/patched by Toshio Ernie Kuratomi <<a class="reference external" href="mailto:a.badger%40gmail.com">a<span>.</span>badger<span>@</span>gmail<span>.</span>com</a>>)</li>
<li>Correct unicode issue when calling/embedding unicode templates inside of other templtes (testcase Tests.Unicode.JPQ_UTF8_Test3. reported by Jean-Baptiste Quenot <<a class="reference external" href="mailto:jbq%40caraldi.com">jbq<span>@</span>caraldi<span>.</span>com</a>>)</li>
<li>Added –shbang option (e.g. “cheetah compile –shbang ‘#!/usr/bin/python2.6’ “)</li>
<li>Removed dependency on optik OptionParser in favor of builtin Python optparse module</li>
<li>Introduction of the #transform directive for whole-document filtering</li>
<li>Introduction of Cheetah.contrib.markdown and Cheetah.Filters.Markdown for outputting a markdown processed template (meant for #transform)</li>
<li>Cheetah.Filters.CodeHighlighter, pygments-based code highlighting filter for use with #transform</li>
<li>Addition of “useLegacyImportMode” compiler setting (defaulted to True) to allow for older (read: broken) import behavior</li>
</ul>
</dd>
<dt>2.1.0.1 (March 27, 2009)</dt>
<dd><ul class="first last simple">
<li>Fix inline import issue introduced in v2.1.0</li>
</ul>
</dd>
<dt>2.1.0 (March 16, 2009)</dt>
<dd><ul class="first last simple">
<li>Quiet DeprecationWarnings being printed to stderr when using Cheetah on Python 2.6 and up. Patch suggested by Satoru SATOH <<a class="reference external" href="mailto:satoru.satoh%40gmail.com">satoru<span>.</span>satoh<span>@</span>gmail<span>.</span>com</a>></li>
<li>Apply patch to support parallel compilation of templates courtesy of Evan Klitzke <<a class="reference external" href="mailto:evan%40eklitzke.org">evan<span>@</span>eklitzke<span>.</span>org</a>></li>
<li>Corrected issue when __getattr__ calls on searchList objects raise exceptions (<a class="reference external" href="mailto:tyler%40slide.com">tyler<span>@</span>slide<span>.</span>com</a>)</li>
<li>make autocalling in valueForName correctly ignore newstyle classes and instances
that are callable, as it does for oldstyle classes and instances. Patch
from <a class="reference external" href="mailto:lucas%40endian.com">lucas<span>@</span>endian<span>.</span>com</a>
[TR]</li>
<li>made it possible to chain multiple decorators to a method #def [TR with
patch from Graham Dennis]</li>
<li>fixed a bug in _eatMultiLineDef that Graham Dennis reported. [TR]</li>
<li>fixed ‘module.__init__() argument 1 must be string, not unicode’ bug in
Template.py reported by Erwin Ambrosch [TR]</li>
</ul>
</dd>
<dt>2.0.1 (Nov 16, 2007)</dt>
<dd><ul class="first last simple">
<li>fixed a deadlock Christoph Zwerschke found in Cheetah.ImportHooks.
[TR]</li>
</ul>
</dd>
<dt>2.0 (Oct 12, 2007)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!</p>
<ul class="simple">
<li>fixed exception handling issue in the C implemenation of NameMapper
[patch from Eric Huss]</li>
<li>fixed filtering of #included subtemplates
[patch from Brian Bird]</li>
</ul>
<p class="last">See the release notes from 2.0b1-5 and 2.0rc1-8 for other changes since
Cheetah 1.0.</p>
</dd>
<dt>2.0rc8 (April 11, 2007)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote class="last">
<div><ul>
<li><p class="first">added a ‘#unicode <encoding>’ directive to indicate that the output of the
template should be a unicode string even if the template source is a
normal byte string.</p>
<blockquote>
<div><ul>
<li><p class="first">#unicode and #encoding are mutually exclusive. Use one or the other.</p>
</li>
<li><p class="first">#unicode must be on a line by itself.</p>
</li>
<li><p class="first">Strings in embedded code must be explictly marked as unicode if they
contain non-ascii chars:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#unicode latin-1
\$f(u"<some non-ascii char>") ## right
\$f("<some non-ascii char>") ## wrong
</pre></div>
</div>
<p>However, this works fine:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#unicode latin-1</span>
<span class="n">blah</span> <span class="n">blah</span> <span class="o"><</span><span class="n">some</span> <span class="n">non</span><span class="o">-</span><span class="n">ascii</span> <span class="n">char</span><span class="o">></span> <span class="n">blah</span> <span class="n">blah</span>
</pre></div>
</div>
</li>
</ul>
</div></blockquote>
</li>
<li><p class="first">fixed several unicode bugs in the compiler.</p>
</li>
<li><p class="first">fixed some unicode issues in the standard filters.</p>
</li>
<li><p class="first">fixed a few minor bugs in code that never gets called. Thanks to
Alejandro Dubrovsky for pointing them out.</p>
</li>
<li><p class="first">make RawOrEncodedUnicode the baseclass of all filters and remove some
unused/redudant filters</p>
</li>
<li><p class="first">added new compiler setting ‘addTimestampsToCompilerOutput’. See Brian
Bird’s post about it. He stores his cheetah generated .py files in
subversion and needed to disable the timestamp code so svn wouldn’t care
when he recompiles those .py modules.</p>
</li>
<li><p class="first">added the #super directive, which calls the method from the parent class
which has the same as the current #def or #block method:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#def foo</span>
<span class="o">...</span> <span class="n">child</span> <span class="n">output</span>
<span class="c1">#super ## includes output of super(<CurrentClass>, self).foo()</span>
<span class="o">...</span> <span class="n">child</span> <span class="n">output</span>
<span class="c1">#end def</span>
<span class="c1">#def bar(arg)</span>
<span class="o">...</span> <span class="n">child</span> <span class="n">output</span>
<span class="c1">#super(arg) ## includes output of super(<CurrentClass>, self).bar(arg)</span>
<span class="o">...</span> <span class="n">child</span> <span class="n">output</span>
<span class="c1">#end def</span>
</pre></div>
</div>
</li>
<li><p class="first">added some unit tests for the new directives</p>
</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc7 (July 4, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">extended the #implements directive so an arguments list can be declared in
the same fashion as #def and #block.</p>
</li>
<li><p class="first">made the parser raise ParseError when $*placeholder, $*5*placeholder,
$(placeholder), etc. are found within expressions. They are only valid in
top-level text.</p>
</li>
<li><p class="first">tweaked the parser so it’s possible to place a comment on the same line as
a directive without needing to explicitly close the directive first. This
works regardless of whether or not you added a colon:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="bp">self</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"#if 1:</span><span class="se">\\</span><span class="s2">n\$aStr</span><span class="se">\\</span><span class="s2">n#end if</span><span class="se">\\</span><span class="s2">n"</span><span class="p">,</span>
<span class="s2">"blarg</span><span class="se">\\</span><span class="s2">n"</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"#if 1: </span><span class="se">\\</span><span class="s2">n\$aStr</span><span class="se">\\</span><span class="s2">n#end if</span><span class="se">\\</span><span class="s2">n"</span><span class="p">,</span>
<span class="s2">"blarg</span><span class="se">\\</span><span class="s2">n"</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"#if 1: ##comment </span><span class="se">\\</span><span class="s2">n\$aStr</span><span class="se">\\</span><span class="s2">n#end if</span><span class="se">\\</span><span class="s2">n"</span><span class="p">,</span>
<span class="s2">"blarg</span><span class="se">\\</span><span class="s2">n"</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"#if 1 ##comment </span><span class="se">\\</span><span class="s2">n\$aStr</span><span class="se">\\</span><span class="s2">n#end if</span><span class="se">\\</span><span class="s2">n"</span><span class="p">,</span>
<span class="s2">"blarg</span><span class="se">\\</span><span class="s2">n"</span><span class="p">)</span>
</pre></div>
</div>
<p>Previously, that last test would have required an extra # to close the #if
directive before the comment directive started:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="bp">self</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"#if 1 ###comment </span><span class="se">\\</span><span class="s2">n\$aStr</span><span class="se">\\</span><span class="s2">n#end if</span><span class="se">\\</span><span class="s2">n"</span><span class="p">,</span>
<span class="s2">"blarg</span><span class="se">\\</span><span class="s2">n"</span><span class="p">)</span>
</pre></div>
</div>
<p>Code that makes use of explicit directive close tokens immediately followed by
another directive will still work as expected:
#if test##for i in range(10)# foo $i#end for##end if</p>
</li>
<li><p class="first">safer handling of the baseclass arg to Template.compile(). It now does
the right thing if the user passes in an instance rather than a class.</p>
</li>
</ul>
</div></blockquote>
<p>ImportHooks: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">made it possible to specify a list of template filename extentions that are
looped through while searching for template modules. E.g.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">Cheetah.ImportHooks</span>
<span class="n">Cheetah</span><span class="o">.</span><span class="n">ImportHooks</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">templateFileExtensions</span><span class="o">=</span><span class="p">(</span><span class="s1">'.tmpl'</span><span class="p">,</span><span class="s1">'.cheetah'</span><span class="p">))</span>
</pre></div>
</div>
</li>
</ul>
</div></blockquote>
<p>Core changes by MO:</p>
<blockquote class="last">
<div><ul class="simple">
<li>Filters are now new-style classes.</li>
<li>WebSafe and the other optional filters in Filters.py now use
RawOrEncodedUnicode instead of Filter as a base class. This allows them
to work with Unicode values containing non-ASCII characters.</li>
<li>User-written custom filters should inherit from RawOrEncodedUnicode
and call the superclass .filter() instead of str(). str() as of
Python 2.4.2 still converts Unicode to string using ASCII codec,
which raises UnicodeEncodeError if it contains non-ASCII characters.</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc6 (Feb 4, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote class="last">
<div><ul>
<li><p class="first">added a Cheetah version dependency check that raises an assertion if a
template was compiled with a previous version of Cheetah whose templates
must be recompiled.</p>
</li>
<li><p class="first">made the Cheetah compilation metadata accessible via class attributes in
addition to module globals</p>
</li>
<li><p class="first">major improvement to exception reporting in cases where bad Python syntax
slips past the Cheetah parser:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>File "/usr/lib/python2.4/site-packages/Cheetah/Template.py", line 792, in compile
raise parseError
Cheetah.Parser.ParseError:
Error in the Python code which Cheetah generated for this template:
================================================================================
invalid syntax (DynamicallyCompiledCheetahTemplate.py, line 86)
Line|Python Code
----|-------------------------------------------------------------
84 |
85 | write('\\n\\n')
86 | for i an range(10): # generated from line 4, col 1
^
87 | _v = i # '\$i' on line 5, col 3
88 | if _v is not None: write(_filter(_v, rawExpr='\$i')) # from line 5, col 3.
89 | write('\\n')
================================================================================
Here is the corresponding Cheetah code:
Line 4, column 1
Line|Cheetah Code
----|-------------------------------------------------------------
2 |#compiler useNameMapper=False
3 |
4 |#for i an range(10)
^
5 | \$i
6 |#end for
7 |
</pre></div>
</div>
</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc5 (Feb 3, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul class="simple">
<li>fixed a memory leak in Template.compile(), reported by Andrea Arcangeli</li>
<li>simplified concurrency locking and compile caching in Template.compile()</li>
</ul>
</div></blockquote>
<p>The command line tool (CheetahWrapper.py):</p>
<blockquote class="last">
<div><ul class="simple">
<li>added new option –settings for supplying compiler settings</li>
<li>added new option –templateAPIClass to replace the environment var
CHEETAH_TEMPLATE_CLASS lookup I added in 2.0b1</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc4 (Jan 31, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote class="last">
<div><ul class="simple">
<li>fixed a typo-bug in the compile hashing code in Template.compile()</li>
<li>improved the macros framework and made it possible to implement macros in
Python code so they can be shared between templates</li>
<li>more work on the #i18n directive. It’s now a macro directive.</li>
<li>added new Cheetah.Macros package</li>
<li>more tests</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc3 (Jan 29, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">added short-form single line versions of all directives that have an #end
tag, except for #errorCatcher:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#if, #else, #elif, #unless,</span>
<span class="c1">#for, #while, #repeat,</span>
<span class="c1">#try, #except, #finally,</span>
<span class="c1">#cache, #raw</span>
<span class="c1">#call, #capture</span>
</pre></div>
</div>
<p>The #def and #block directives already had single-line versions:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#if cond: foo</span>
<span class="c1">#elif cond2: bar</span>
<span class="c1">#else: blarg</span>
<span class="c1">#for i, val in enumerate(vals): \$i-\$val</span>
</pre></div>
</div>
<p>Note that if you accidentally leave a colon at the end of one of these
directives but nothing else follows it, aside from whitespace, the parser
will treat it as a normal multi-line directive.</p>
<p>The first leading space after the colon is discarded. Any additional
spaces will be included in the output.</p>
<p>Also note, if you use the short form versions of #if/#else/#elif you must
it for all three. The following is not valid:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#if cond: foo</span>
<span class="c1">#elif cond2</span>
<span class="n">bar</span>
<span class="c1">#else: blarg</span>
</pre></div>
</div>
</li>
<li><p class="first">added support for $!silentModePlaceholders. This is the same as quiet
mode in Velocity: <a class="reference external" href="http://jakarta.apache.org/velocity/docs/user-guide.html#Quiet%20Reference%20Notation">http://jakarta.apache.org/velocity/docs/user-guide.html#Quiet%20Reference%20Notation</a></p>
</li>
<li><p class="first">added support for function/method @decorators. It also works with blocks.
As in vanilla Python, the @decorator statement must be followed with a
function/method definition (i.e. #def or #block):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#from xxx import aDecorator</span>
<span class="o">...</span>
<span class="o">...</span>
<span class="c1">#@aDecorator</span>
<span class="c1">#def func</span>
<span class="n">foo</span>
<span class="c1">#end def</span>
<span class="c1">#@aDecorator</span>
<span class="c1">#def singleLineShortFormfunc: foo</span>
<span class="c1">#@aDecorator</span>
<span class="c1">#block func2</span>
<span class="n">bar</span>
<span class="c1">#end block</span>
</pre></div>
</div>
</li>
<li><p class="first">added a new callback hook ‘handlerForExtendsDirective’ to the compiler settings. It
can be used to customize the handling of #extends directives. The
callback can dynamically add import statements or rewrite the baseclass’
name if needed:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">baseClassName</span> <span class="o">=</span> <span class="n">handler</span><span class="p">(</span><span class="n">compiler</span><span class="p">,</span> <span class="n">baseClassName</span><span class="p">)</span>
</pre></div>
</div>
<p>See the discussion on the mailing list on Jan 25th for more details.</p>
</li>
<li><p class="first">changed the default filter to the one that doesn’t try to encode Unicode
It was ‘EncodeUnicode’ and is now ‘RawOrEncodedUnicode’.</p>
</li>
<li><p class="first">added optional support for parsing whitespace between the directive start
token (#) and directive names, per Christophe Eymard’s request. For the
argument behind this see the mailing list archives for Jan 29th. This is
off by default. You must turn it on using the compiler setting
allowWhitespaceAfterDirectiveStartToken=True:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#for \$something in \$another
# for \$somethin2 in \$another2
blahblah \$something in \$something2
# end for
#end for
</pre></div>
</div>
</li>
<li><p class="first">made the handling of Template.compile()’s preprocessors arg simpler and
fixed a bug in it.</p>
</li>
<li><p class="first">fixed attribute name bug in the .compile() method (it affected the feature
that allows generated module files to be cached for better exception
tracebacks)</p>
</li>
<li><p class="first">refactored the #cache/CacheRegions code to support abitrary backend cache
data stores.</p>
</li>
<li><p class="first">added MemcachedCacheStore, which allows cache data to be stored in a
memcached backend. See <a class="reference external" href="http://www.linuxjournal.com/article/7451">http://www.linuxjournal.com/article/7451</a> and
<a class="reference external" href="http://www.danga.com/memcached/">http://www.danga.com/memcached/</a>. This is only appropriate for systems
running many Python server processes that need to share cached data to
reduce memory requirements. Don’t bother with this unless you actually
need it. If you have a limited number of Python server processes it is
much faster, simpler, and more secure to just cache in the memory of each
process.</p>
<p>KEEP MEMCACHED’S LIMITED SECURITY IN MIND!! It has no authentication or
encryption and will introduce a gaping hole in your defenses unless you
are careful. If you are caching sensitive data you should take measures
to ensure that a) untrusted local system users cannot connect to memcached
server, b) untrusted external servers cannot connect, and c) untrusted
users on trusted external servers cannot connect. Case (a) can be dealt
with via iptable’s owner match module for one way to do this: “iptables -A
… -m owner …” Cases (b) and (c) can be handled by tunnelling
memcached network connections over stunnel and implementing stunnel
authentication with mandatory peer/client certs.</p>
</li>
<li><p class="first">some under-the-hood refactoring of the parser</p>
</li>
<li><p class="first">made it possible to add custom directives, or customize the
parsing/handling of existing ones, via the compiler settings
‘directiveNamesAndParsers’ and ‘endDirectiveNamesAndHandlers’</p>
</li>
<li><p class="first">added a compile-time macro facility to Cheetah. These macros are very
similar to macros in Lisp:
<a class="reference external" href="http://www.apl.jhu.edu/~hall/Lisp-Notes/Macros.html">http://www.apl.jhu.edu/~hall/Lisp-Notes/Macros.html</a>.</p>
<p>As with Lisp macros, they take source code (Cheetah source) as input and
return source code (again Cheetah source) as output. They are executed at
compile-time, just like in Lisp and C. The resultant code
gets executed at run-time.</p>
<p>The new #defmacro directive allows users to create macros inside the
source of their templates. Macros can also be provided via the compiler
setting ‘macroDirectives’. The ‘macroDirectives’ setting allows you to
share common macros between templates.</p>
<p>The syntax for the opening tag of #defmacro is the same as for #def and
#block. It expects a macro name followed by an optional argument list in
brackets. A <cite>src</cite> argument is automatically added to the beginning of
every macro’s argument list. The value of the <cite>src</cite> is the block of
input source code that is provided during a macro call (see below):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#defmacro <macroname>[(argspec)]</span>
<span class="o"><</span><span class="n">macrobody</span><span class="o">></span>
<span class="c1">#end defmacro</span>
</pre></div>
</div>
<p>All of Cheetah’s syntax is available for use inside macros, but the
placeholderStartToken is @ instead of $ and the
directiveStartToken/EndToken is % instead of #. Any syntax using the
standard $/# tokens will be treated as plain text and included in the output
of the macro.</p>
<p>Here are some examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#defmacro addHeaderFooter</span>
<span class="n">header</span>
<span class="nd">@src</span>
<span class="n">footer</span>
<span class="c1">#end defmacro</span>
<span class="c1">#defmacro addHeaderFooter(header='h', footer='f')</span>
<span class="nd">@header</span>
<span class="nd">@src</span>
<span class="nd">@footer</span>
<span class="c1">#end defmacro</span>
</pre></div>
</div>
<p>There is a single-line short form like for other directives:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1">#defmacro addHeaderFooter: header @src footer</span>
<span class="c1">#defmacro addHeaderFooter(header='h', footer='f'): @header @src @footer</span>
</pre></div>
</div>
<p>The syntax for calling a macro is similar to the simplest usage of the
#call directive:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#addHeaderFooter
Source \$code to wrap
#end addHeaderFooter
#addHeaderFooter: Source \$code to wrap
#addHeaderFooter header='header', footer='footer: Source \$code to wrap
</pre></div>
</div>
<dl class="docutils">
<dt>In Elisp you write</dt>
<dd><dl class="first last docutils">
<dt>(defmacro inc (var)</dt>
<dd><p class="first last">(list ‘setq var (list ‘1+ var)))</p>
</dd>
</dl>
</dd>
<dt>to define the macro <cite>inc</cite> and write</dt>
<dd><p class="first last">(inc x)</p>
</dd>
<dt>which expands to</dt>
<dd><p class="first last">(setq x (1+ x))</p>
</dd>
<dt>In Cheetah you’d write</dt>
<dd><p class="first last">#defmacro inc: #set @src +=1
#inc: $i</p>
</dd>
<dt>which expands to</dt>
<dd><p class="first">#set $i += 1</p>
<p class="last">print Template(“””\
#defmacro inc: #set @src +=1
#set i = 1
#inc: $i
$i”””).strip()==2</p>
</dd>
</dl>
</li>
<li><p class="first">fixed some bugs related to advanced usage of Template.compile(). These
were found via new unit tests. No one had actually run into them yet.</p>
</li>
<li><p class="first">added the initial bits of an #i18n directive. It has the same semantics
as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#call self.handleI18n
Some \$var cheetah source
#end call
</pre></div>
</div>
<p>but has a simpler syntax:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#i18n
Some \$var cheetah source
#end i18n
## single-line short form:
#i18n: Some \$var cheetah source
</pre></div>
</div>
<p>The method it calls, self.handleI18n, is just a stub at the moment, but it
will soon be a wrapper around gettext. It currently has one required
positional argument <cite>message</cite>. I anticipate supporting the following
optional arguments:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">id</span> <span class="o">=</span> <span class="n">msgid</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">translation</span> <span class="n">catalog</span>
<span class="n">domain</span> <span class="o">=</span> <span class="n">translation</span> <span class="n">domain</span>
<span class="n">source</span> <span class="o">=</span> <span class="n">source</span> <span class="n">lang</span>
<span class="n">target</span> <span class="o">=</span> <span class="n">a</span> <span class="n">specific</span> <span class="n">target</span> <span class="n">lang</span>
<span class="n">comment</span> <span class="o">=</span> <span class="n">a</span> <span class="n">comment</span> <span class="n">to</span> <span class="n">the</span> <span class="n">translation</span> <span class="n">team</span>
<span class="n">plural</span> <span class="o">=</span> <span class="n">the</span> <span class="n">plural</span> <span class="n">form</span> <span class="n">of</span> <span class="n">the</span> <span class="n">message</span>
<span class="n">n</span> <span class="o">=</span> <span class="n">a</span> <span class="n">sized</span> <span class="n">argument</span> <span class="n">to</span> <span class="n">distinguish</span> <span class="n">between</span> <span class="n">single</span> <span class="ow">and</span> <span class="n">plural</span> <span class="n">forms</span>
</pre></div>
</div>
<p>#i18n is executed at runtime, but it can also be used in conjunction with
a Cheetah preprocessor or macro (see above) to support compile time
translation of strings that don’t have to deal with plural forms.</p>
</li>
<li><p class="first">added Cheetah.Utils.htmlEncode and Cheetah.Utils.htmlDecode</p>
</li>
<li><p class="first">more docstring text</p>
</li>
</ul>
</div></blockquote>
<p>Unit tests: [TR]</p>
<blockquote class="last">
<div><ul class="simple">
<li>extended the caching tests</li>
<li>added tests for the various calling styles of Template.compile()</li>
<li>added copies of all the SyntaxAndOutput tests that use a template
baseclass other than <cite>Template</cite>. This ensures that all syntax & core
features work with 2.0’s support for arbitrary baseclasses.</li>
<li>added tests for all the new directives and the new single-line short forms</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc2 (Jan 13th, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul class="simple">
<li>fixed some python 2.4isms that slipped in. All the tests pass with Python
2.2 now</li>
<li>added lots more docstring content in the Template class</li>
<li>made multiline comments gobble whitespace like other directives, per JJ’s
request. The rather longwinded compiler setting
gobbleWhitespaceAroundMultiLineComments can be used to go back to the old
non-gobbling behaviour if needed.</li>
<li>added #capture directive to complement the #call directive.
#call executes a region of Cheetah code and passes its output into a function call
#capture executes a region of Cheetah code and assigns its output to a variable</li>
<li>extended the compile caching code in Template.compile so it works with the
‘file’ arg.</li>
<li>added cacheModuleFilesForTracebacks and cacheDirForModuleFiles args to
Template.compile(). See the docstring for details.</li>
<li>misc internal refactoring in the parser</li>
<li>improved handling of keyword args in the __init__ method and fixed a
potential clash between the namespaces and searchList args</li>
</ul>
</div></blockquote>
<p>WWW: [TR]</p>
<blockquote class="last">
<div><ul class="simple">
<li>added the source for the new Cheetah website layout/content</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0rc1 (Jan 10, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">made it possible nest #filter directives</p>
</li>
<li><p class="first">added lots more docstring content in the Template class</p>
</li>
<li><p class="first">added Template.subclass() classmethod for quickly creating subclasses of
existing Cheetah template classes. It takes the same args as the
.compile() classmethod and returns a template that is a subclass of the
template .subclass() is called from:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">T1</span> <span class="o">=</span> <span class="n">Template</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s1">' foo - \$meth1 - bar</span><span class="se">\\</span><span class="s1">n#def meth1: this is T1.meth1'</span><span class="p">)</span>
<span class="n">T2</span> <span class="o">=</span> <span class="n">T1</span><span class="o">.</span><span class="n">subclass</span><span class="p">(</span><span class="s1">'#implements meth1</span><span class="se">\\</span><span class="s1">n this is T2.meth1'</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p class="first">added baseclass arg to Template.compile(). It simplifies the reuse of
dynamically compiled templates:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># example 1, quickly subclassing a normal Python class and using its</span>
<span class="c1"># __init__ call signature:</span>
<span class="n">dictTemplate</span> <span class="o">=</span> <span class="n">Template</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s1">'hello \$name from \$caller'</span><span class="p">,</span> <span class="n">baseclass</span><span class="o">=</span><span class="nb">dict</span><span class="p">)</span>
<span class="nb">print</span> <span class="n">dictTemplate</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'world'</span><span class="p">,</span> <span class="n">caller</span><span class="o">=</span><span class="s1">'me'</span><span class="p">)</span>
</pre></div>
</div>
<p># example 2, mixing a Cheetah method into a class definition:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Foo</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">meth1</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="s1">'foo'</span>
<span class="k">def</span> <span class="nf">meth2</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="s1">'bar'</span>
<span class="n">Foo</span> <span class="o">=</span> <span class="n">Template</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s1">'#implements meth3</span><span class="se">\\</span><span class="s1">nhello \$name from \$caller'</span><span class="p">,</span>
<span class="n">baseclass</span><span class="o">=</span><span class="n">Foo</span><span class="p">)</span>
<span class="nb">print</span> <span class="n">Foo</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'world'</span><span class="p">,</span> <span class="n">caller</span><span class="o">=</span><span class="s1">'me'</span><span class="p">)</span>
</pre></div>
</div>
<p>A side-benefit is the possibility to use the same Cheetah source with
several baseclass, as the baseclass is orthogonal to the source code,
unlike the #extends directive.</p>
</li>
<li><p class="first">added ‘namespaces’ as an alias for ‘searchList’ in Template.__init__</p>
</li>
<li><p class="first">made it possible to pass in a single namespace to ‘searchList’, which will
automatically be converted into a list.</p>
</li>
<li><dl class="first docutils">
<dt>fixed issue with buffering and use of #call when template is used as a</dt>
<dd><p class="first last">webkit servlet</p>
</dd>
</dl>
</li>
<li><p class="first">added Cheetah.Utils.htmlEncode and htmlDecode</p>
</li>
</ul>
</div></blockquote>
<p>The command line tool (CheetahWrapper.py):</p>
<blockquote class="last">
<div><ul class="simple">
<li>changed insertion order for the –env and –pickle options so they match the
commandline UI of the compiled template modules themselves [TR]</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0b5 (Jan 7, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">made Cheetah.Template a new-style class by inserting ‘object’ into its’
inheritance tree. Templates can now use super(), properties and all the
other goodies that come with new-style classes.</p>
</li>
<li><p class="first">removed the WebInputMixin by placing its one method directly in the
Template class.</p>
</li>
<li><p class="first">removed the SettingsManager Mixin. It wasn’t being used by anything
anymore.</p>
</li>
<li><p class="first">added a framework for caching the results of compilations in
Template.compile(). This is on by default and protects against bad
performance issues that are due to programmers misguidedly compiling
templates inside tight loops. It also saves on memory usage.</p>
</li>
<li><p class="first">misc attr name changes to avoid namespace pollution</p>
</li>
<li><p class="first">more + improved docstrings</p>
</li>
<li><p class="first">replaced the oldstyle dynamic compile hacks with a wrapper around
Template.compile(). The old usage pattern Template(src) now benefits from
most of the recent changes:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Template</span><span class="p">(</span><span class="n">src</span><span class="p">)</span><span class="o">.</span><span class="vm">__class__</span> <span class="o">==</span> <span class="n">Template</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="n">src</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p class="first">removed all the extra imports required by oldstyle dynamic compile hacks</p>
</li>
<li><p class="first">converted the cheetah #include mechanism to newstyle compilation and made it
more flexible</p>
</li>
<li><p class="first">made the #include mechanism work with file objects in addition to file names</p>
</li>
<li><p class="first">made the handling of args to Template.compile() more flexible. You can now
provide defaults via class attributes.</p>
</li>
<li><p class="first">made preprocessors for Template.compile() work with file arguments</p>
</li>
<li><p class="first">added support for specifying a __metaclass__ on cheetah template classes</p>
</li>
<li><p class="first">refactored both the class and instance initialization processes</p>
</li>
<li><p class="first">improved the handling of __str__ in _assignRequiredMethodsToClass</p>
</li>
</ul>
</div></blockquote>
<p>The command line tool (CheetahWrapper.py): [TR]</p>
<blockquote>
<div><ul class="simple">
<li>improved error output in CheetahWrapper</li>
<li>switched fill command over to new style compile usage</li>
</ul>
</div></blockquote>
<p>Unit tests: [TR]</p>
<blockquote class="last">
<div><ul class="simple">
<li>fixed format string bug in unittest_local_copy.py</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0b4 (Jan 6, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">fixed up parsing of target lists in for loops. This was previously limited
to fairly simple target lists:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#for (\$i, \$j) in [('aa','bb'),('cc','dd')]
\$i.upper,\$j.upper
#end for"
#for (i, j) in [('aa','bb'),('cc','dd')]
\$i.upper,\$j.upper
#end for"
#for i,(j, k) in enumerate([('aa','bb'),('cc','dd')])
\$j.upper,\$k.upper
#end for"
</pre></div>
</div>
</li>
<li><p class="first">refactored the class initialization process</p>
</li>
<li><p class="first">improved handling of target lists in #set directive. This was previously
limited to fairly simple target lists.
#set i,j = [1,2] … #set $i,$j = [1,2]
#set (i,j) = [1,2] … #set ($i,$j) = [1,2]
#set i, (j,k) = [1,(2,3)] … #set $i, ($j,$k) = [1,(2,3)]</p>
</li>
<li><p class="first">made it possible for the expressionFilter hooks to modify the code chunks
they are fed. Also documented the hooks in a docstring. Thus the hooks
can be used as preprocessors for expressions, ‘restricted execution’, or
even enforcement of style guidelines.</p>
</li>
<li><p class="first">removed cheetah junk from docstrings and placed it all in comments or
__moduleVars__. Per JJ’s suggestion.</p>
</li>
<li><p class="first">made it possible to nest #cache directives to any level</p>
</li>
<li><p class="first">made it possible to nest #call directives to any level</p>
</li>
</ul>
</div></blockquote>
<p>Unit Tests [TR]</p>
<blockquote class="last">
<div><ul class="simple">
<li>extended tests for #for directive</li>
<li>expanded tests for #set directive</li>
<li>expanded tests for #call directive</li>
<li>expanded tests for #cache directive</li>
<li>added basic tests for the new $placeholder string expressions:
c’text $placeholder text’</li>
</ul>
</div></blockquote>
</dd>
<dt>2.0b3 (Jan 5, 2006)</dt>
<dd><p class="first">!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]</p>
<blockquote>
<div><ul>
<li><p class="first">added #yield statement</p>
</li>
<li><p class="first">added ability to create nested scopes/functions via nested #def statements</p>
</li>
<li><p class="first">added new #call directive and related #arg directive, per Ian Bicking’s
suggestion.</p>
</li>
<li><p class="first">added new expression syntax c”text $placeholder text”</p>
<blockquote>
<div><p>for those basic function calling cases where you just need to pass in a
small bit of cheetah output as an argument:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">c</span><span class="s1">'a string with \$placeholders'</span><span class="p">,</span>
<span class="n">c</span><span class="s1">'''a string with \$placeholders'''</span><span class="p">,</span>
<span class="n">c</span><span class="s2">"a string with \$placeholders"</span><span class="p">,</span>
<span class="n">c</span><span class="s2">"""a string with \$placeholders"""</span>
</pre></div>
</div>
<ul>
<li><p class="first">They can’t contain #directives, but accept any valid $placeholder syntax
except caching placeholders. Caching placeholders don’t make any sense in
this context.</p>
</li>
<li><p class="first">They can be used *any* place where a python expression is expected.</p>
</li>
<li><p class="first">They can be nested to any depth:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>\$func(c'<li>\$var1-\$var2</li>')
\$func(c'<li>\$var1-\$var2</li>', doSomething=True)
\$func(content=c'<li>\$var1-\$var2</li>', doSomething=True)
\$func(lambda x,y: c'<li>\$x-\$y</li>')
\$func(callback=lambda x,y: c'<li>\$x-\$y</li>')
\$func(lambda x,y: c'<li>\$x-\$y-\$varInSearchList</li>')
\$func(c'<li>\$var1-\$var2-\$(var3\*10)-\$(94.3\*58)</li>')
\$func(c'<li>\$var1-\$var2-\$func2(c"a nested expr \$var99")</li>')
#if \$cond then c'<li>\$var1-\$var2</li>' else c'<p>\$var1-\$var2</p>'
#def foo(arg1=c'\$var1<span class="foo">\$var2</span>'): blah \$arg1 blah
\$foo(c'\$var1<i>\$var2</i>')
</pre></div>
</div>
</li>
</ul>
</div></blockquote>
</li>
<li><p class="first">added preprocessor hooks to Template.compile()
can be used for partial completion or ‘compile-time-caching’
… more details and examples coming. It’s very useful, but takes a bit
of explaining.</p>
</li>
<li><p class="first">added ‘#set module varName = expr’ for adding module globals. JJ’s suggestion</p>
</li>
<li><p class="first">improved generated docstring notes about cached vars</p>
</li>
<li><p class="first">fixed silly bug related to “”” in docstring comments and statements like
this ‘#def foo: $str(“””foo”””)’. Reported by JJ.</p>
</li>
<li><p class="first">changed the handling of single-line defs so that
‘#def xxx:<just whitespace>\n’ will be treated as a multi-line #def.
The same applies to #block. There’s a compiler setting to turn this off
if you really need empty single-line #def:’s.
JJ reported that this was causing great confusion with beginners.</p>
</li>
<li><p class="first">improved error message for unclosed directives, per Mike Orr’s suggestion.</p>
</li>
<li><p class="first">added optional support for passing the trans arg to methods via **KWS rather
than trans=None. See the discussion on the mailing list Jan 4th (JJ’s post) for
details. The purpose is to avoid a positional argument clash that
apparently is very confusing for beginners.</p>
<blockquote>
<div><p>Note that any existing client code that passing the trans arg in
positionally rather than as a keyword will break as a result. WebKit
does this with the .respond method so I’ve kept the old style there.
You can also turn this new behaviour off by either manually including
the trans arg in your method signature (see the example below) or by
using the compiler setting ‘useKWsDictArgForPassingTrans’=False:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>#def manualOverride(arg1, trans=None)
foo \$arg1
#end def
</pre></div>
</div>
</div></blockquote>
</li>
</ul>
</div></blockquote>
<p>ImportHooks:</p>
<blockquote>
<div><ul class="simple">
<li>made the ImportHook more robust against compilation errors during import [TR]</li>
</ul>
</div></blockquote>
<p>Install scripts: [TR]</p>
<blockquote>
<div><ul class="simple">
<li>added optional support for pje’s setuptools</li>
<li>added cheeseshop classifiers</li>
<li>removed out of date install instructions in __init__.py</li>
</ul>
</div></blockquote>
<p>Servlet Base Class For Webkit: [TR]</p>
<blockquote>
<div><ul class="simple">
<li>disabled assignment of self.application (was a webware hack)</li>
</ul>
</div></blockquote>
<p>Unit Tests: [TR]</p>
<blockquote class="last">
<div><ul class="simple">
<li>unit tests for most of the new syntax elements</li>
<li>tidied up some old tests</li>
<li>misc refactoring</li>
</ul>
</div></blockquote>
</dd>