blob: 72e9cee4b60978b67097ff084bfc2a80b0621a94 [file] [log] [blame]
Mike Bayer7553fb82019-08-01 12:13:22 -04001
Mike Bayerbf98abb2014-01-09 19:22:41 -05002=========
3Changelog
4=========
5
Hugo van Kemenade4bb7bb32023-09-16 17:20:56 -040061.3
Mike Bayer92ef70f2014-01-09 19:42:17 -05007===
8
Mike Bayerbf98abb2014-01-09 19:22:41 -05009.. changelog::
Mike Bayer9b7bf5d2024-05-14 08:22:21 -040010 :version: 1.3.6
11 :include_notes_from: unreleased
12
13.. changelog::
Mike Bayerc9c05342024-05-13 21:18:15 -040014 :version: 1.3.5
Mike Bayera54313f2024-05-14 08:21:13 -040015 :released: Tue May 14 2024
16
17 .. change::
18 :tags: bug, lexer, regression
19 :tickets: 400, 401
20
21 Reverted the fix for :ticket:`400` as it caused new issues when traversing
22 some bracketed situations.
23
Mike Bayerc9c05342024-05-13 21:18:15 -040024
25.. changelog::
Mike Bayerdcc211c2024-05-14 08:02:28 -040026 :version: 1.3.4 (yanked)
Mike Bayer98dfd9d2024-05-13 21:17:17 -040027 :released: Mon May 13 2024
28
29 .. change::
Mike Bayerdcc211c2024-05-14 08:02:28 -040030 :tags: bug, lexer
Mike Bayer98dfd9d2024-05-13 21:17:17 -040031 :tickets: 398
32
33 Fixed regression caused by the fix for :ticket:`320` where new logic added
34 to interpret list and dictionary comprehensions would fail for expression
35 oriented keys. As the parsing in question was not necessary for these
36 keys, it's been removed. Pull request courtesy Sébastien Granjoux.
37
38 .. change::
39 :tags: bug, lexer
40 :tickets: 400
41
42 Fixed issue where a parsed expression which contained sub-brackets, such as
43 dictionary literals, would fail to be interpreted correctly even though the
44 initial parsing is correct. Pull request courtesy Jose Galvez.
Mike Bayeraf80cbd2024-04-10 11:32:59 -040045
Mike Bayerdcc211c2024-05-14 08:02:28 -040046 .. note:: this change was **reverted** and release 1.3.4 was yanked as
47 this fix caused regressions.
48
Mike Bayeraf80cbd2024-04-10 11:32:59 -040049.. changelog::
Mike Bayer28155892024-01-30 08:31:04 -050050 :version: 1.3.3
Mike Bayer6b91faa2024-04-10 11:30:51 -040051 :released: Wed Apr 10 2024
52
53 .. change::
54 :tags: bug, codegen
55 :tickets: 146
56
57 Fixed unexpected error when use control lines which the
58 first control block with no bodies other than comments,
59 as `pass` is now added to the first empty block.
60 Pull request courtesy Hai Zhu.
61
62 .. change::
63 :tags: bug, parser
64 :tickets: 320
65
66 Fixed unexpected syntax error in strict_undefined mode that occurred
67 when using comprehensions within a function in a Mako Python code block.
68 Now, the local variable in comprehensions won't be added to the checklist
69 when using strict_undefined mode.
70 Pull request courtesy Hai Zhu.
Mike Bayer28155892024-01-30 08:31:04 -050071
72.. changelog::
Mike Bayer2c647ad2024-01-22 15:49:10 -050073 :version: 1.3.2
Mike Bayerb0e88752024-01-30 08:29:37 -050074 :released: Tue Jan 30 2024
75
76 .. change::
77 :tags: bug, lexer
78 :tickets: 323
79
80 Fixed parsing issue where attempting to render a single percent sign %
81 using an escaped percent %% would not function correctly if the escaped
82 percent were not the first character on a line. Note that this is a revised
83 version of a similar change made in Mako 1.3.1 which caused unexpected
84 parsing regressions, resulting in the release being yanked.
85 Pull request courtesy Hai Zhu.
Mike Bayer2c647ad2024-01-22 15:49:10 -050086
87.. changelog::
Mike Bayerdc666142023-11-08 14:27:35 -050088 :version: 1.3.1
Mike Bayer499f1292024-01-22 15:47:35 -050089 :released: Mon Jan 22 2024
90
91 .. change::
92 :tags: bug, lexer
93 :tickets: 323
94
95 Fixed parsing issue where attempting to render a single percent sign ``%``
96 using an escaped percent ``%%`` would not function correctly if the escaped
97 percent were not the first character on a line. Pull request courtesy Hai
98 Zhu.
Mike Bayerdc666142023-11-08 14:27:35 -050099
Hai Zhu1d6c58e2024-01-26 09:01:57 -0500100 .. note:: Mako 1.3.1 was yanked from pypi and this change was reverted,
101 replaced with a modified version for Mako 1.3.2.
102
Mike Bayerdc666142023-11-08 14:27:35 -0500103.. changelog::
Hugo van Kemenade4bb7bb32023-09-16 17:20:56 -0400104 :version: 1.3.0
Mike Bayer51505642023-11-08 14:26:03 -0500105 :released: Wed Nov 8 2023
106
107 .. change::
108 :tags: change, installation
109
110 Mako 1.3.0 bumps the minimum Python version to 3.8, as 3.7 is EOL as of
111 2023-06-27. Python 3.12 is now supported explicitly.
Mike Bayer35960832022-11-15 09:40:50 -0500112
Hugo van Kemenade4bb7bb32023-09-16 17:20:56 -04001131.2
114===
115
116
Mike Bayer35960832022-11-15 09:40:50 -0500117.. changelog::
Mike Bayer0c4e7372022-09-22 15:55:41 -0400118 :version: 1.2.4
Mike Bayer2fd5daa2022-11-15 09:36:43 -0500119 :released: Tue Nov 15 2022
120
121 .. change::
122 :tags: bug, codegen
123 :tickets: 368
124
125 Fixed issue where unpacking nested tuples in a for loop using would raise a
126 "couldn't apply loop context" error if the loop context was used. The regex
127 used to match the for loop expression now allows the list of loop variables
128 to contain parenthesized sub-tuples. Pull request courtesy Matt Trescott.
129
Mike Bayer0c4e7372022-09-22 15:55:41 -0400130
131.. changelog::
Mike Bayerc2f392e2022-08-29 14:04:23 -0400132 :version: 1.2.3
Mike Bayer86b20182022-09-22 15:54:07 -0400133 :released: Thu Sep 22 2022
134
135 .. change::
136 :tags: bug, lexer
137 :tickets: 367
138
139 Fixed issue in lexer in the same category as that of :ticket:`366` where
140 the regexp used to match an end tag didn't correctly organize for matching
141 characters surrounded by whitespace, leading to high memory / interpreter
142 hang if a closing tag incorrectly had a large amount of unterminated space
143 in it. Credit to Sebastian Chnelik for locating the issue.
144
145 As Mako templates inherently render and directly invoke arbitrary Python
146 code from the template source, it is **never** appropriate to create
147 templates that contain untrusted input.
Mike Bayerc2f392e2022-08-29 14:04:23 -0400148
149.. changelog::
Mike Bayer87a4a252022-06-30 11:47:11 -0400150 :version: 1.2.2
Mike Bayer5054cc02022-08-29 14:00:07 -0400151 :released: Mon Aug 29 2022
152
153 .. change::
154 :tags: bug, lexer
155 :tickets: 366
156
157 Fixed issue in lexer where the regexp used to match tags would not
158 correctly interpret quoted sections individually. While this parsing issue
159 still produced the same expected tag structure later on, the mis-handling
160 of quoted sections was also subject to a regexp crash if a tag had a large
Mike Bayer0babe1c2022-09-22 14:52:59 -0400161 number of quotes within its quoted sections. Credit to Sebastian
162 Chnelik for locating the issue.
163
164 As Mako templates inherently render and directly invoke arbitrary Python
165 code from the template source, it is **never** appropriate to create
166 templates that contain untrusted input.
Mike Bayer87a4a252022-06-30 11:47:11 -0400167
168.. changelog::
Mike Bayer86025c02022-03-10 16:07:41 -0500169 :version: 1.2.1
Mike Bayer00f1b332022-06-30 11:42:50 -0400170 :released: Thu Jun 30 2022
171
172 .. change::
173 :tags: performance
174 :tickets: 361
175
176 Optimized some codepaths within the lexer/Python code generation process,
177 improving performance for generation of templates prior to their being
178 cached. Pull request courtesy Takuto Ikuta.
179
180 .. change::
181 :tags: bug, tests
182 :tickets: 360
183
184 Various fixes to the test suite in the area of exception message rendering
185 to accommodate for variability in Python versions as well as Pygments.
Mike Bayer86025c02022-03-10 16:07:41 -0500186
187.. changelog::
Michael Bourke291d2302022-01-03 17:57:50 +1100188 :version: 1.2.0
Mike Bayer363189d2022-03-10 15:36:14 -0500189 :released: Thu Mar 10 2022
Michael Bourked7a1e5e2022-01-18 06:40:48 +0000190
191 .. change::
192 :tags: changed, py3k
193 :tickets: 351
194
195 Corrected "universal wheel" directive in ``setup.cfg`` so that building a
196 wheel does not target Python 2.
197
198 .. change::
199 :tags: changed, py3k
200
201 The ``bytestring_passthrough`` template argument is removed, as this
202 flag only applied to Python 2.
203
204 .. change::
205 :tags: changed, py3k
206
207 With the removal of Python 2's ``cStringIO``, Mako now uses its own
208 internal ``FastEncodingBuffer`` exclusively.
209
210 .. change::
211 :tags: changed, py3k
212
213 Removed ``disable_unicode`` flag, that's no longer used in Python 3.
214
215 .. change::
216 :tags: changed
217 :tickets: 349
218
219 Refactored test utilities into ``mako.testing`` module. Removed
220 ``unittest.TestCase`` dependency in favor of ``pytest``.
221
222 .. change::
223 :tags: changed, setup
224
225 Replaced the use of ``pkg_resources`` with the ``importlib`` library.
226 For Python < 3.8 the library ``importlib_metadata`` is used.
227
228 .. change::
229 :tags: changed, py3k
230
231 Removed support for Python 2 and Python 3.6. Mako now requires Python >=
232 3.7.
233
234 .. change::
235 :tags: bug, py3k
236
237 Mako now performs exception chaining using ``raise from``, correctly
238 identifying underlying exception conditions when it raises its own
239 exceptions. Pull request courtesy Ram Rachum.
Mike Bayer6e416b02021-08-20 12:32:41 -0400240
Mike Bayer5feab892021-10-25 22:05:40 -04002411.1
242===
243
Mike Bayer7bb0e4d2021-11-17 10:46:57 -0500244.. changelog::
245 :version: 1.1.6
246 :released: Wed Nov 17 2021
247
248 .. change::
249 :tags: bug, lexer
250 :tickets: 346
251 :versions: 1.2.0, 1.1.6
252
253 Fixed issue where control statements on multi lines with a backslash would
254 not parse correctly if the template itself contained CR/LF pairs as on
255 Windows. Pull request courtesy Charles Pigott.
256
Mike Bayer5feab892021-10-25 22:05:40 -0400257
Mike Bayer6e416b02021-08-20 12:32:41 -0400258.. changelog::
Mike Bayerc2c690a2021-01-14 13:30:47 -0500259 :version: 1.1.5
Mike Bayer5b99a412021-08-20 12:28:16 -0400260 :released: Fri Aug 20 2021
261
262 .. change::
263 :tags: bug, tests
264 :tickets: 338
265
266 Fixed some issues with running the test suite which would be revealed by
267 running tests in random order.
268
269
Mike Bayerc2c690a2021-01-14 13:30:47 -0500270
271.. changelog::
Mike Bayer75fbbae2020-05-29 16:30:52 -0400272 :version: 1.1.4
Mike Bayer1cdcd162021-01-14 13:29:04 -0500273 :released: Thu Jan 14 2021
274
275 .. change::
276 :tags: bug, py3k
277 :tickets: 328
278
279 Fixed Python deprecation issues related to module importing, as well as
280 file access within the Lingua plugin, for deprecated APIs that began to
281 emit warnings under Python 3.10. Pull request courtesy Petr Viktorin.
Mike Bayer75fbbae2020-05-29 16:30:52 -0400282
283.. changelog::
Mike Bayerf619c282020-03-01 12:40:07 -0500284 :version: 1.1.3
Mike Bayer1f879912020-05-29 16:29:44 -0400285 :released: Fri May 29 2020
286
287 .. change::
288 :tags: bug, templates
289 :tickets: 267
290
291 The default template encoding is now utf-8. Previously, the encoding was
292 "ascii", which was standard throughout Python 2. This allows that
293 "magic encoding comment" for utf-8 templates is no longer required.
294
Mike Bayerf619c282020-03-01 12:40:07 -0500295
296.. changelog::
Mike Bayer699b37a2020-01-20 16:16:55 -0500297 :version: 1.1.2
Mike Bayer6f8fd032020-03-01 12:36:29 -0500298 :released: Sun Mar 1 2020
299
300 .. change::
301 :tags: feature, commands
302 :tickets: 283
303
304 Added --output-file argument to the Mako command line runner, which allows
305 a specific output file to be selected. Pull request courtesy Björn
306 Dahlgren.
Mike Bayer699b37a2020-01-20 16:16:55 -0500307
308.. changelog::
Mike Bayereda9a832019-08-01 12:29:03 -0400309 :version: 1.1.1
Mike Bayer95abf862020-01-20 16:12:40 -0500310 :released: Mon Jan 20 2020
311
312 .. change::
313 :tags: bug, py3k
314 :tickets: 310
315
316 Replaced usage of the long-superseded "parser.suite" module in the
317 mako.util package for parsing the python magic encoding comment with the
318 "ast.parse" function introduced many years ago in Python 2.5, as
319 "parser.suite" is emitting deprecation warnings in Python 3.9.
320
321
322
323 .. change::
324 :tags: bug, ext
325 :tickets: 304
326
327 Added "babel" and "lingua" dependency entries to the setuptools entrypoints
328 for the babel and lingua extensions, so that pkg_resources can check that
329 these extra dependencies are available, raising an informative
330 exception if not. Pull request courtesy sinoroc.
331
332
Mike Bayereda9a832019-08-01 12:29:03 -0400333
334.. changelog::
Mike Bayerba709172019-07-27 11:14:04 -0400335 :version: 1.1.0
Mike Bayerb6f3ae92019-08-01 12:26:55 -0400336 :released: Thu Aug 1 2019
337
338 .. change::
339 :tags: bug, py3k, windows
340 :tickets: 301
341
342 Replaced usage of time.clock() on windows as well as time.time() elsewhere
343 for microsecond timestamps with timeit.default_timer(), as time.clock() is
344 being removed in Python 3.8. Pull request courtesy Christoph Reiter.
345
346
347 .. change::
348 :tags: bug, py3k
349 :tickets: 295
350
351 Replaced usage of ``inspect.getfullargspec()`` with the vendored version
352 used by SQLAlchemy, Alembic to avoid future deprecation warnings. Also
353 cleans up an additional version of the same function that's apparently
354 been floating around for some time.
355
356
357 .. change::
358 :tags: changed, setup
359 :tickets: 303
360
361 Removed the "python setup.py test" feature in favor of a straight run of
362 "tox". Per Pypa / pytest developers, "setup.py" commands are in general
363 headed towards deprecation in favor of tox. The tox.ini script has been
364 updated such that running "tox" with no arguments will perform a single run
365 of the test suite against the default installed Python interpreter.
366
367 .. seealso::
368
369 https://github.com/pypa/setuptools/issues/1684
370
371 https://github.com/pytest-dev/pytest/issues/5534
372
373 .. change::
374 :tags: changed, py3k, installer
375 :tickets: 249
376
377 Mako 1.1 now supports Python versions:
378
379 * 2.7
380 * 3.4 and higher
381
382 This includes that setup.py no longer includes any conditionals, allowing
383 for a pure Python wheel build, however this is not necessarily part of the
384 Pypi release process as of yet. The test suite also raises for Python
385 deprecation warnings.
386
Mike Bayer74c6bda2019-07-20 12:33:44 -0400387
Mike Bayer9a7d70a2019-07-29 22:48:17 -04003881.0
389===
390
Mike Bayer74c6bda2019-07-20 12:33:44 -0400391.. changelog::
Mike Bayer4861e0d2019-07-01 15:26:01 -0400392 :version: 1.0.14
Mike Bayer0398aaf2019-07-20 12:27:47 -0400393 :released: Sat Jul 20 2019
394
395 .. change::
396 :tags: feature, template
397
398 The ``n`` filter is now supported in the ``<%page>`` tag. This allows a
399 template to omit the default expression filters throughout a whole
400 template, for those cases where a template-wide filter needs to have
401 default filtering disabled. Pull request courtesy Martin von Gagern.
402
403 .. seealso::
404
405 :ref:`expression_filtering_nfilter`
406
407
408
409 .. change::
410 :tags: bug, exceptions
411
412 Fixed issue where the correct file URI would not be shown in the
413 template-formatted exception traceback if the template filename were not
414 known. Additionally fixes an issue where stale filenames would be
415 displayed if a stack trace alternated between different templates. Pull
416 request courtesy Martin von Gagern.
417
Mike Bayer4861e0d2019-07-01 15:26:01 -0400418
419.. changelog::
Mike Bayerf384df72019-06-05 22:20:05 -0400420 :version: 1.0.13
Mike Bayer5b3a4a42019-07-01 15:24:28 -0400421 :released: Mon Jul 1 2019
422
423 .. change::
424 :tags: bug, exceptions
425
426 Improved the line-number tracking for source lines inside of Python ``<%
427 ... %>`` blocks, such that text- and HTML-formatted exception traces such
428 as that of :func:`.html_error_template` now report the correct source line
429 inside the block, rather than the first line of the block itself.
430 Exceptions in ``<%! ... %>`` blocks which get raised while loading the
431 module are still not reported correctly, as these are handled before the
432 Mako code is generated. Pull request courtesy Martin von Gagern.
Mike Bayerf384df72019-06-05 22:20:05 -0400433
434.. changelog::
Mike Bayer9f23c602019-05-31 14:49:30 -0400435 :version: 1.0.12
Mike Bayer6b722162019-06-05 22:17:57 -0400436 :released: Wed Jun 5 2019
437
438 .. change::
439 :tags: bug, py3k
440 :tickets: 296
441
442 Fixed regression where import refactors in Mako 1.0.11 caused broken
443 imports on Python 3.8.
444
Mike Bayer9f23c602019-05-31 14:49:30 -0400445
446.. changelog::
Mike Bayer5b079542019-05-10 10:05:47 -0400447 :version: 1.0.11
Mike Bayere233e252019-05-31 14:39:44 -0400448 :released: Fri May 31 2019
449
450 .. change::
Mike Bayer1c29e842019-08-01 12:22:32 -0400451 :tags: changed
Mike Bayere233e252019-05-31 14:39:44 -0400452
453 Updated for additional project metadata in setup.py. Additionally,
454 the code has been reformatted using Black and zimports.
Mike Bayer5b079542019-05-10 10:05:47 -0400455
456.. changelog::
Mike Bayer50170dd2019-04-15 11:59:44 -0400457 :version: 1.0.10
Mike Bayer191e18b2019-05-10 10:04:20 -0400458 :released: Fri May 10 2019
Mike Bayer50170dd2019-04-15 11:59:44 -0400459
Mike Bayere77d6402019-05-09 23:07:17 -0400460 .. change::
461 :tags: bug, py3k
462 :tickets: 293
463
464 Added a default encoding of "utf-8" when the :class:`.RichTraceback`
465 object retrieves Python source lines from a Python traceback; as these
466 are bytes in Python 3 they need to be decoded so that they can be
467 formatted in the template.
468
Mike Bayer50170dd2019-04-15 11:59:44 -0400469.. changelog::
Mike Bayerf2459622019-03-20 11:59:30 -0400470 :version: 1.0.9
Mike Bayer6633c0f2019-04-15 11:48:03 -0400471 :released: Mon Apr 15 2019
Mike Bayerf2459622019-03-20 11:59:30 -0400472
Miro Hrončok8ace3ad2019-04-11 12:02:04 -0400473 .. change::
474 :tags: bug
475 :tickets: 287
476
477 Further corrected the previous fix for :ticket:`287` as it relied upon
478 an attribute that is monkeypatched by Python's ``ast`` module for some
479 reason, which fails if ``ast`` hasn't been imported; the correct
480 attribute ``Constant.value`` is now used. Also note the issue
481 was mis-numbered in the previous changelog note.
482
Mike Bayerf2459622019-03-20 11:59:30 -0400483.. changelog::
lacsaPc4808542017-11-15 14:14:29 +0100484 :version: 1.0.8
Mike Bayerbe7486a2019-03-20 11:51:29 -0400485 :released: Wed Mar 20 2019
Mike Bayer4fd4ddb2019-03-20 11:57:37 -0400486 :released: Wed Mar 20 2019
lacsaPc4808542017-11-15 14:14:29 +0100487
488 .. change::
Mike Bayer3e97da42019-03-20 11:15:47 -0400489 :tags: bug
Miro Hrončok8ace3ad2019-04-11 12:02:04 -0400490 :tickets: 287
Mike Bayer3e97da42019-03-20 11:15:47 -0400491
492 Fixed an element in the AST Python generator which changed
493 for Python 3.8, causing expression generation to fail.
494
495 .. change::
lacsaPc4808542017-11-15 14:14:29 +0100496 :tags: feature
497 :tickets: 271
498
499 Added ``--output-encoding`` flag to the mako-render script.
500 Pull request courtesy lacsaP.
501
Hugo7c58e122018-01-16 08:58:02 +0200502 .. change::
503 :tags: bug
504
Mike Bayer11537952019-03-20 11:55:55 -0400505 Removed unnecessary "usage" prefix from mako-render script.
506 Pull request courtesy Hugo.
Hugo7c58e122018-01-16 08:58:02 +0200507
lacsaPc4808542017-11-15 14:14:29 +0100508.. changelog::
Mike Bayerc7b37922017-07-05 15:13:49 -0400509 :version: 1.0.7
Mike Bayere63e7782017-07-13 12:12:05 -0400510 :released: Thu Jul 13 2017
Mike Bayerc7b37922017-07-05 15:13:49 -0400511
Yves Chevallier037a95e2017-06-15 10:06:14 -0400512 .. change::
513 :tags: bug
514
515 Changed the "print" in the mako-render command to
516 sys.stdout.write(), avoiding the extra newline at the end
517 of the template output. Pull request courtesy
518 Yves Chevallier.
519
Mike Bayerc7b37922017-07-05 15:13:49 -0400520.. changelog::
Mike Bayera1872812016-11-08 17:26:31 -0500521 :version: 1.0.6
Mike Bayer8e83c752016-11-09 16:11:29 -0500522 :released: Wed Nov 9 2016
Mike Bayera1872812016-11-08 17:26:31 -0500523
Huayi Zhang45bef5d2016-11-08 17:20:03 -0500524 .. change::
525 :tags: feature
526
527 Added new parameter :paramref:`.Template.include_error_handler` .
528 This works like :paramref:`.Template.error_handler` but indicates the
529 handler should take place when this template is included within another
530 template via the ``<%include>`` tag. Pull request courtesy
531 Huayi Zhang.
532
Mike Bayera1872812016-11-08 17:26:31 -0500533.. changelog::
Mike Bayere51eac22016-11-02 22:08:59 -0400534 :version: 1.0.5
Mike Bayer270f3df2016-11-02 22:11:33 -0400535 :released: Wed Nov 2 2016
Mike Bayere51eac22016-11-02 22:08:59 -0400536
537 .. change::
538 :tags: bug
539
540 Updated the Sphinx documentation builder to work with recent
541 versions of Sphinx.
542
543.. changelog::
Mike Bayer3cc98d12016-03-09 16:48:35 -0500544 :version: 1.0.4
Mike Bayer366aed42016-03-10 17:08:30 -0500545 :released: Thu Mar 10 2016
Mike Bayer3cc98d12016-03-09 16:48:35 -0500546
Mike Bayerd31e4b42016-03-09 17:33:39 -0500547 .. change::
Mike Bayer48b04e62016-03-10 16:54:46 -0500548 :tags: feature, test
549
550 The default test runner is now py.test. Running "python setup.py test"
551 will make use of py.test instead of nose. nose still works as a test
552 runner as well, however.
553
554 .. change::
Mike Bayer09a95622016-03-09 17:38:24 -0500555 :tags: bug, lexer
556 :pullreq: github:19
557
558 Major improvements to lexing of intricate Python sections which may
559 contain complex backslash sequences, as well as support for the bitwise
560 operator (e.g. pipe symbol) inside of expression sections distinct
561 from the Mako "filter" operator, provided the operator is enclosed
562 within parentheses or brackets. Pull request courtesy Daniel Martin.
563
564 .. change::
Mike Bayerd31e4b42016-03-09 17:33:39 -0500565 :tags: feature
Mike Bayerd31e4b42016-03-09 17:33:39 -0500566
567 Added new method :meth:`.Template.list_defs`. Pull request courtesy
568 Jonathan Vanasco.
Mike Bayer752d2312016-03-09 16:50:35 -0500569
Mike Bayer3cc98d12016-03-09 16:48:35 -0500570.. changelog::
Mike Bayer48a961e2015-10-26 19:57:34 -0400571 :version: 1.0.3
Mike Bayer1cfcf162015-10-27 12:38:54 -0400572 :released: Tue Oct 27 2015
Mike Bayer48a961e2015-10-26 19:57:34 -0400573
574 .. change::
575 :tags: bug, babel
Mike Bayer48a961e2015-10-26 19:57:34 -0400576
577 Fixed an issue where the Babel plugin would not handle a translation
578 symbol that contained non-ascii characters. Pull request courtesy
579 Roman Imankulov.
580
581.. changelog::
Cody Taylor52e8c0a2015-03-24 20:57:02 -0400582 :version: 1.0.2
Mike Bayer1de5a332015-08-26 14:02:40 -0400583 :released: Wed Aug 26 2015
Cody Taylor52e8c0a2015-03-24 20:57:02 -0400584
585 .. change::
Mike Bayer28caab32015-08-26 14:00:25 -0400586 :tags: bug, installation
587 :tickets: 249
588
589 The "universal wheel" marker is removed from setup.cfg, because
590 our setup.py currently makes use of conditional dependencies.
591 In :ticket:`249`, the discussion is ongoing on how to correct our
592 setup.cfg / setup.py fully so that we can handle the per-version
593 dependency changes while still maintaining optimal wheel settings,
594 so this issue is not yet fully resolved.
595
596 .. change::
Mike Bayer4707bb02015-08-26 13:58:22 -0400597 :tags: bug, py3k
598 :tickets: 250
599
600 Repair some calls within the ast module that no longer work on Python3.5;
601 additionally replace the use of ``inspect.getargspec()`` under
602 Python 3 (seems to be called from the TG plugin) to avoid deprecation
603 warnings.
604
605 .. change::
Mike Bayerbaabd622015-06-03 09:43:15 -0400606 :tags: bug
Mike Bayerbaabd622015-06-03 09:43:15 -0400607
608 Update the Lingua translation extraction plugin to correctly
609 handle templates mixing Python control statements (such as if,
610 for and while) with template fragments. Pull request courtesy
611 Laurent Daverio.
612
613 .. change::
Cody Taylor52e8c0a2015-03-24 20:57:02 -0400614 :tags: feature
615 :tickets: 236
616
Mike Bayer6e784292015-03-25 15:50:08 -0400617 Added ``STOP_RENDERING`` keyword for returning/exiting from a
618 template early, which is a synonym for an empty string ``""``.
619 Previously, the docs suggested a bare
Cody Taylor52e8c0a2015-03-24 20:57:02 -0400620 ``return``, but this could cause ``None`` to appear in the
621 rendered template result.
622
Mike Bayer6e784292015-03-25 15:50:08 -0400623 .. seealso::
624
625 :ref:`syntax_exiting_early`
626
Cody Taylor52e8c0a2015-03-24 20:57:02 -0400627.. changelog::
Mike Bayer3fae17c2014-12-10 15:08:38 -0500628 :version: 1.0.1
Mike Bayer1f770b12015-01-22 16:38:57 -0500629 :released: Thu Jan 22 2015
Mike Bayer3fae17c2014-12-10 15:08:38 -0500630
631 .. change::
Mike Bayer77571992015-01-22 11:12:47 -0500632 :tags: feature
Mike Bayer77571992015-01-22 11:12:47 -0500633
634 Added support for Lingua, a translation extraction system as an
635 alternative to Babel. Pull request courtesy Wichert Akkerman.
636
637 .. change::
Mike Bayer3fae17c2014-12-10 15:08:38 -0500638 :tags: bug, py3k
Mike Bayer3fae17c2014-12-10 15:08:38 -0500639
Mike Bayer77571992015-01-22 11:12:47 -0500640 Modernized the examples/wsgi/run_wsgi.py file for Py3k.
Mike Bayer3fae17c2014-12-10 15:08:38 -0500641 Pull requset courtesy Cody Taylor.
642
643.. changelog::
Mike Bayer12856b12014-04-28 17:33:15 -0400644 :version: 1.0.0
Mike Bayer285bc812014-06-08 16:31:33 -0400645 :released: Sun Jun 8 2014
Mike Bayerbf98abb2014-01-09 19:22:41 -0500646
647 .. change::
Mike Bayer464cc7d2014-05-23 11:50:13 -0400648 :tags: bug, py2k
Mike Bayer464cc7d2014-05-23 11:50:13 -0400649
650 Improved the error re-raise operation when a custom
651 :paramref:`.Template.error_handler` is used that does not handle
652 the exception; the original stack trace etc. is now preserved.
653 Pull request courtesy Manfred Haltner.
654
655 .. change::
Mike Bayerb9609362014-05-12 11:51:05 -0400656 :tags: bug, py2k, filters
Mike Bayerb9609362014-05-12 11:51:05 -0400657
658 Added an html_escape filter that works in "non unicode" mode.
659 Previously, when using ``disable_unicode=True``, the ``u`` filter
660 would fail to handle non-ASCII bytes properly. Pull request
661 courtesy George Xie.
662
663 .. change::
Mike Bayer12856b12014-04-28 17:33:15 -0400664 :tags: general
665
666 Compatibility changes; in order to modernize the codebase, Mako
667 is now dropping support for Python 2.4 and Python 2.5 altogether.
668 The source base is now targeted at Python 2.6 and forwards.
669
670 .. change::
Mike Bayerda4737c2014-03-14 18:03:19 -0400671 :tags: feature
672
673 Template modules now generate a JSON "metadata" structure at the bottom
674 of the source file which includes parseable information about the
675 templates' source file, encoding etc. as well as a mapping of module
676 source lines to template lines, thus replacing the "# SOURCE LINE"
677 markers throughout the source code. The structure also indicates those
678 lines that are explicitly not part of the template's source; the goal
Mike Bayer2858e562014-04-28 17:47:29 -0400679 here is to allow better integration with coverage and other tools.
680
681 .. change::
682 :tags: bug, py3k
683
684 Fixed bug in ``decode.<encoding>`` filter where a non-string object
685 would not be correctly interpreted in Python 3.
686
687 .. change::
Mike Bayerc314ecf2014-04-13 13:35:13 -0400688 :tags: bug, py3k
689 :tickets: 227
690
691 Fixed bug in Python parsing logic which would fail on Python 3
692 when a "try/except" targeted a tuple of exception types, rather
693 than a single exception.
694
695 .. change::
Mike Bayer4e2084b2014-04-11 12:32:02 -0400696 :tags: feature
Mike Bayer12856b12014-04-28 17:33:15 -0400697
698 mako-render is now implemented as a setuptools entrypoint script;
699 a standalone mako.cmd.cmdline() callable is now available, and the
700 system also uses argparse now instead of optparse. Pull request
701 courtesy Derek Harland.
702
703 .. change::
704 :tags: feature
Mike Bayer4e2084b2014-04-11 12:32:02 -0400705
706 The mako-render script will now catch exceptions and run them
707 into the text error handler, and exit with a non-zero exit code.
708 Pull request courtesy Derek Harland.
709
710 .. change::
Mike Bayerbf98abb2014-01-09 19:22:41 -0500711 :tags: bug
Mike Bayerbf98abb2014-01-09 19:22:41 -0500712
713 A rework of the mako-render script allows the script to run
714 correctly when given a file pathname that is outside of the current
715 directory, e.g. ``mako-render ../some_template.mako``. In this case,
716 the "template root" defaults to the directory in which the template
717 is located, instead of ".". The script also accepts a new argument
718 ``--template-dir`` which can be specified multiple times to establish
719 template lookup directories. Standard input for templates also works
720 now too. Pull request courtesy Derek Harland.
721
Mike Bayer2858e562014-04-28 17:47:29 -0400722 .. change::
723 :tags: feature, py3k
724 :pullreq: github:7
725
726 Support is added for Python 3 "keyword only" arguments, as used in
727 defs. Pull request courtesy Eevee.
728
729
Mike Bayer12856b12014-04-28 17:33:15 -04007300.9
731===
732
Mike Bayerbf98abb2014-01-09 19:22:41 -0500733.. changelog::
734 :version: 0.9.1
735 :released: Thu Dec 26 2013
736
737 .. change::
738 :tags: bug
739 :tickets: 225
740
741 Fixed bug in Babel plugin where translator comments
742 would be lost if intervening text nodes were encountered.
743 Fix courtesy Ned Batchelder.
744
745 .. change::
746 :tags: bug
747 :tickets:
748
749 Fixed TGPlugin.render method to support unicode template
750 names in Py2K - courtesy Vladimir Magamedov.
751
752 .. change::
753 :tags: bug
754 :tickets:
755
756 Fixed an AST issue that was preventing correct operation
757 under alpha versions of Python 3.4. Pullreq courtesy Zer0-.
758
759 .. change::
760 :tags: bug
761 :tickets:
762
763 Changed the format of the "source encoding" header output
764 by the code generator to use the format ``# -*- coding:%s -*-``
765 instead of ``# -*- encoding:%s -*-``; the former is more common
766 and compatible with emacs. Courtesy Martin Geisler.
767
768 .. change::
769 :tags: bug
770 :tickets: 224
771
772 Fixed issue where an old lexer rule prevented a template line
773 which looked like "#*" from being correctly parsed.
774
775.. changelog::
776 :version: 0.9.0
Mike Bayer92ef70f2014-01-09 19:42:17 -0500777 :released: Tue Aug 27 2013
Mike Bayerbf98abb2014-01-09 19:22:41 -0500778
779 .. change::
780 :tags: bug
781 :tickets: 219
782
783 The Context.locals_() method becomes a private underscored
784 method, as this method has a specific internal use. The purpose
785 of Context.kwargs has been clarified, in that it only delivers
786 top level keyword arguments originally passed to template.render().
787
788 .. change::
789 :tags: bug
790 :tickets:
791
792 Fixed the babel plugin to properly interpret ${} sections
793 inside of a "call" tag, i.e. <%self:some_tag attr="${_('foo')}"/>.
794 Code that's subject to babel escapes in here needs to be
795 specified as a Python expression, not a literal. This change
796 is backwards incompatible vs. code that is relying upon a _('')
797 translation to be working within a call tag.
798
799 .. change::
800 :tags: bug
801 :tickets: 187
802
803 The Babel plugin has been repaired to work on Python 3.
804
805 .. change::
806 :tags: bug
807 :tickets: 207
808
809 Using <%namespace import="*" module="somemodule"/> now
810 skips over module elements that are not explcitly callable,
811 avoiding TypeError when trying to produce partials.
812
813 .. change::
814 :tags: bug
815 :tickets: 190
816
817 Fixed Py3K bug where a "lambda" expression was not
818 interpreted correctly within a template tag; also
819 fixed in Py2.4.
820
Mike Bayer92ef70f2014-01-09 19:42:17 -05008210.8
822===
Mike Bayerbf98abb2014-01-09 19:22:41 -0500823
824.. changelog::
825 :version: 0.8.1
826 :released: Fri May 24 2013
827
828 .. change::
829 :tags: bug
830 :tickets: 216
831
832 Changed setup.py to skip installing markupsafe
833 if Python version is < 2.6 or is between 3.0 and
834 less than 3.3, as Markupsafe now only supports 2.6->2.X,
835 3.3->3.X.
836
837 .. change::
838 :tags: bug
839 :tickets: 214
840
841 Fixed regression where "entity" filter wasn't
842 converted for py3k properly (added tests.)
843
844 .. change::
845 :tags: bug
846 :tickets: 212
847
848 Fixed bug where mako-render script wasn't
849 compatible with Py3k.
850
851 .. change::
852 :tags: bug
853 :tickets: 213
854
855 Cleaned up all the various deprecation/
856 file warnings when running the tests under
857 various Pythons with warnings turned on.
858
859.. changelog::
860 :version: 0.8.0
861 :released: Wed Apr 10 2013
862
863 .. change::
864 :tags: feature
865 :tickets:
866
867 Performance improvement to the
868 "legacy" HTML escape feature, used for XML
869 escaping and when markupsafe isn't present,
870 courtesy George Xie.
871
872 .. change::
873 :tags: bug
874 :tickets: 209
875
876 Fixed bug whereby an exception in Python 3
877 against a module compiled to the filesystem would
878 fail trying to produce a RichTraceback due to the
879 content being in bytes.
880
881 .. change::
882 :tags: bug
883 :tickets: 208
884
885 Change default for compile()->reserved_names
886 from tuple to frozenset, as this is expected to be
887 a set by default.
888
889 .. change::
890 :tags: feature
891 :tickets:
892
893 Code has been reworked to support Python 2.4->
894 Python 3.xx in place. 2to3 no longer needed.
895
896 .. change::
897 :tags: feature
898 :tickets:
899
900 Added lexer_cls argument to Template,
901 TemplateLookup, allows alternate Lexer classes
902 to be used.
903
904 .. change::
905 :tags: feature
906 :tickets:
907
908 Added future_imports parameter to Template
909 and TemplateLookup, renders the __future__ header
910 with desired capabilities at the top of the generated
911 template module. Courtesy Ben Trofatter.
912
Mike Bayer92ef70f2014-01-09 19:42:17 -05009130.7
914===
Mike Bayerbf98abb2014-01-09 19:22:41 -0500915
916.. changelog::
917 :version: 0.7.3
918 :released: Wed Nov 7 2012
919
920 .. change::
921 :tags: bug
922 :tickets:
923
924 legacy_html_escape function, used when
925 Markupsafe isn't installed, was using an inline-compiled
926 regexp which causes major slowdowns on Python 3.3;
927 is now precompiled.
928
929 .. change::
930 :tags: bug
931 :tickets: 201
932
933 AST supporting now supports tuple-packed
934 function arguments inside pure-python def
935 or lambda expressions.
936
937 .. change::
938 :tags: bug
939 :tickets:
940
941 Fixed Py3K bug in the Babel extension.
942
943 .. change::
944 :tags: bug
945 :tickets:
946
947 Fixed the "filter" attribute of the
948 <%text> tag so that it pulls locally specified
949 identifiers from the context the same
950 way as that of <%block> and <%filter>.
951
952 .. change::
953 :tags: bug
954 :tickets:
955
956 Fixed bug in plugin loader to correctly
957 raise exception when non-existent plugin
958 is specified.
959
960.. changelog::
961 :version: 0.7.2
962 :released: Fri Jul 20 2012
963
964 .. change::
965 :tags: bug
966 :tickets: 193
967
968 Fixed regression in 0.7.1 where AST
969 parsing for Py2.4 was broken.
970
971.. changelog::
972 :version: 0.7.1
973 :released: Sun Jul 8 2012
974
975 .. change::
976 :tags: feature
977 :tickets: 146
978
979 Control lines with no bodies will
980 now succeed, as "pass" is added for these
981 when no statements are otherwise present.
982 Courtesy Ben Trofatter
983
984 .. change::
985 :tags: bug
986 :tickets: 192
987
988 Fixed some long-broken scoping behavior
989 involving variables declared in defs and such,
990 which only became apparent when
991 the strict_undefined flag was turned on.
992
993 .. change::
994 :tags: bug
995 :tickets: 191
996
997 Can now use strict_undefined at the
998 same time args passed to def() are used
999 by other elements of the <%def> tag.
1000
1001.. changelog::
1002 :version: 0.7.0
1003 :released: Fri Mar 30 2012
1004
1005 .. change::
1006 :tags: feature
1007 :tickets: 125
1008
1009 Added new "loop" variable to templates,
1010 is provided within a % for block to provide
1011 info about the loop such as index, first/last,
1012 odd/even, etc. A migration path is also provided
1013 for legacy templates via the "enable_loop" argument
1014 available on Template, TemplateLookup, and <%page>.
1015 Thanks to Ben Trofatter for all
1016 the work on this
1017
1018 .. change::
1019 :tags: feature
1020 :tickets:
1021
1022 Added a real check for "reserved"
1023 names, that is names which are never pulled
1024 from the context and cannot be passed to
1025 the template.render() method. Current names
1026 are "context", "loop", "UNDEFINED".
1027
1028 .. change::
1029 :tags: feature
1030 :tickets: 95
1031
1032 The html_error_template() will now
1033 apply Pygments highlighting to the source
1034 code displayed in the traceback, if Pygments
1035 if available. Courtesy Ben Trofatter
1036
1037 .. change::
1038 :tags: feature
1039 :tickets: 147
1040
1041 Added support for context managers,
1042 i.e. "% with x as e:/ % endwith" support.
1043 Courtesy Ben Trofatter
1044
1045 .. change::
1046 :tags: feature
1047 :tickets: 185
1048
1049 Added class-level flag to CacheImpl
1050 "pass_context"; when True, the keyword argument
1051 'context' will be passed to get_or_create()
1052 containing the Mako Context object.
1053
1054 .. change::
1055 :tags: bug
1056 :tickets: 182
1057
1058 Fixed some Py3K resource warnings due
1059 to filehandles being implicitly closed.
1060
1061 .. change::
1062 :tags: bug
1063 :tickets: 186
1064
1065 Fixed endless recursion bug when
1066 nesting multiple def-calls with content.
1067 Thanks to Jeff Dairiki.
1068
1069 .. change::
1070 :tags: feature
1071 :tickets:
1072
1073 Added Jinja2 to the example
1074 benchmark suite, courtesy Vincent Férotin
1075
Mike Bayer92ef70f2014-01-09 19:42:17 -05001076Older Versions
1077==============
Mike Bayerbf98abb2014-01-09 19:22:41 -05001078
1079.. changelog::
1080 :version: 0.6.2
1081 :released: Thu Feb 2 2012
1082
1083 .. change::
1084 :tags: bug
1085 :tickets: 86, 20
1086
1087 The ${{"foo":"bar"}} parsing issue is fixed!!
1088 The legendary Eevee has slain the dragon!. Also fixes quoting issue
1089 at.
1090
1091.. changelog::
1092 :version: 0.6.1
Mike Bayer92ef70f2014-01-09 19:42:17 -05001093 :released: Sat Jan 28 2012
Mike Bayerbf98abb2014-01-09 19:22:41 -05001094
1095 .. change::
1096 :tags: bug
1097 :tickets:
1098
1099 Added special compatibility for the 0.5.0
1100 Cache() constructor, which was preventing file
1101 version checks and not allowing Mako 0.6 to
1102 recompile the module files.
1103
1104.. changelog::
1105 :version: 0.6.0
1106 :released: Sat Jan 21 2012
1107
1108 .. change::
1109 :tags: feature
1110 :tickets:
1111
1112 Template caching has been converted into a plugin
1113 system, whereby the usage of Beaker is just the
1114 default plugin. Template and TemplateLookup
1115 now accept a string "cache_impl" parameter which
1116 refers to the name of a cache plugin, defaulting
1117 to the name 'beaker'. New plugins can be
1118 registered as pkg_resources entrypoints under
1119 the group "mako.cache", or registered directly
1120 using mako.cache.register_plugin(). The
1121 core plugin is the mako.cache.CacheImpl
1122 class.
1123
1124 .. change::
1125 :tags: feature
1126 :tickets:
1127
1128 Added support for Beaker cache regions
1129 in templates. Usage of regions should be considered
1130 as superseding the very obsolete idea of passing in
1131 backend options, timeouts, etc. within templates.
1132
1133 .. change::
1134 :tags: feature
1135 :tickets:
1136
1137 The 'put' method on Cache is now
1138 'set'. 'put' is there for backwards compatibility.
1139
1140 .. change::
1141 :tags: feature
1142 :tickets:
1143
1144 The <%def>, <%block> and <%page> tags now accept
1145 any argument named "cache_*", and the key
1146 minus the "cache_" prefix will be passed as keyword
1147 arguments to the CacheImpl methods.
1148
1149 .. change::
1150 :tags: feature
1151 :tickets:
1152
1153 Template and TemplateLookup now accept an argument
1154 cache_args, which refers to a dictionary containing
1155 cache parameters. The cache_dir, cache_url, cache_type,
1156 cache_timeout arguments are deprecated (will probably
1157 never be removed, however) and can be passed
1158 now as cache_args={'url':<some url>, 'type':'memcached',
1159 'timeout':50, 'dir':'/path/to/some/directory'}
1160
1161 .. change::
1162 :tags: feature/bug
1163 :tickets: 180
1164
1165 Can now refer to context variables
1166 within extra arguments to <%block>, <%def>, i.e.
1167 <%block name="foo" cache_key="${somekey}">.
1168 Filters can also be used in this way, i.e.
1169 <%def name="foo()" filter="myfilter">
1170 then template.render(myfilter=some_callable)
1171
1172 .. change::
1173 :tags: feature
1174 :tickets: 178
1175
1176 Added "--var name=value" option to the mako-render
1177 script, allows passing of kw to the template from
1178 the command line.
1179
1180 .. change::
1181 :tags: feature
1182 :tickets: 181
1183
1184 Added module_writer argument to Template,
1185 TemplateLookup, allows a callable to be passed which
1186 takes over the writing of the template's module source
1187 file, so that special environment-specific steps
1188 can be taken.
1189
1190 .. change::
1191 :tags: bug
1192 :tickets: 142
1193
1194 The exception message in the html_error_template
1195 is now escaped with the HTML filter.
1196
1197 .. change::
1198 :tags: bug
1199 :tickets: 173
1200
1201 Added "white-space:pre" style to html_error_template()
1202 for code blocks so that indentation is preserved
1203
1204 .. change::
1205 :tags: bug
1206 :tickets: 175
1207
1208 The "benchmark" example is now Python 3 compatible
1209 (even though several of those old template libs aren't
1210 available on Py3K, so YMMV)
1211
1212
1213.. changelog::
1214 :version: 0.5.0
1215 :released: Wed Sep 28 2011
1216
1217 .. change::
1218 :tags:
1219 :tickets: 174
1220
1221 A Template is explicitly disallowed
1222 from having a url that normalizes to relative outside
1223 of the root. That is, if the Lookup is based
1224 at /home/mytemplates, an include that would place
1225 the ultimate template at
1226 /home/mytemplates/../some_other_directory,
1227 i.e. outside of /home/mytemplates,
1228 is disallowed. This usage was never intended
1229 despite the lack of an explicit check.
1230 The main issue this causes
1231 is that module files can be written outside
1232 of the module root (or raise an error, if file perms aren't
1233 set up), and can also lead to the same template being
1234 cached in the lookup under multiple, relative roots.
1235 TemplateLookup instead has always supported multiple
1236 file roots for this purpose.
1237
1238
1239.. changelog::
1240 :version: 0.4.2
1241 :released: Fri Aug 5 2011
1242
1243 .. change::
1244 :tags:
1245 :tickets: 170
1246
1247 Fixed bug regarding <%call>/def calls w/ content
1248 whereby the identity of the "caller" callable
1249 inside the <%def> would be corrupted by the
1250 presence of another <%call> in the same block.
1251
1252 .. change::
1253 :tags:
1254 :tickets: 169
1255
1256 Fixed the babel plugin to accommodate <%block>
1257
1258.. changelog::
1259 :version: 0.4.1
1260 :released: Wed Apr 6 2011
1261
1262 .. change::
1263 :tags:
1264 :tickets: 164
1265
1266 New tag: <%block>. A variant on <%def> that
1267 evaluates its contents in-place.
1268 Can be named or anonymous,
1269 the named version is intended for inheritance
1270 layouts where any given section can be
1271 surrounded by the <%block> tag in order for
1272 it to become overrideable by inheriting
1273 templates, without the need to specify a
1274 top-level <%def> plus explicit call.
1275 Modified scoping and argument rules as well as a
1276 more strictly enforced usage scheme make it ideal
1277 for this purpose without at all replacing most
1278 other things that defs are still good for.
1279 Lots of new docs.
1280
1281 .. change::
1282 :tags:
1283 :tickets: 165
1284
1285 a slight adjustment to the "highlight" logic
1286 for generating template bound stacktraces.
1287 Will stick to known template source lines
1288 without any extra guessing.
1289
1290.. changelog::
1291 :version: 0.4.0
1292 :released: Sun Mar 6 2011
1293
1294 .. change::
1295 :tags:
1296 :tickets:
1297
1298 A 20% speedup for a basic two-page
1299 inheritance setup rendering
1300 a table of escaped data
1301 (see http://techspot.zzzeek.org/2010/11/19/quick-mako-vs.-jinja-speed-test/).
1302 A few configurational changes which
1303 affect those in the I-don't-do-unicode
1304 camp should be noted below.
1305
1306 .. change::
1307 :tags:
1308 :tickets:
1309
1310 The FastEncodingBuffer is now used
1311 by default instead of cStringIO or StringIO,
1312 regardless of whether output_encoding
1313 is set to None or not. FEB is faster than
1314 both. Only StringIO allows bytestrings
1315 of unknown encoding to pass right
1316 through, however - while it is of course
1317 not recommended to send bytestrings of unknown
1318 encoding to the output stream, this
1319 mode of usage can be re-enabled by
1320 setting the flag bytestring_passthrough
1321 to True.
1322
1323 .. change::
1324 :tags:
1325 :tickets:
1326
1327 disable_unicode mode requires that
1328 output_encoding be set to None - it also
1329 forces the bytestring_passthrough flag
1330 to True.
1331
1332 .. change::
1333 :tags:
1334 :tickets: 156
1335
1336 the <%namespace> tag raises an error
1337 if the 'template' and 'module' attributes
1338 are specified at the same time in
1339 one tag. A different class is used
1340 for each case which allows a reduction in
1341 runtime conditional logic and function
1342 call overhead.
1343
1344 .. change::
1345 :tags:
1346 :tickets: 159
1347
1348 the keys() in the Context, as well as
1349 it's internal _data dictionary, now
1350 include just what was specified to
1351 render() as well as Mako builtins
1352 'caller', 'capture'. The contents
1353 of __builtin__ are no longer copied.
1354 Thanks to Daniel Lopez for pointing
1355 this out.
1356
1357
1358.. changelog::
1359 :version: 0.3.6
1360 :released: Sat Nov 13 2010
1361
1362 .. change::
1363 :tags:
1364 :tickets: 126
1365
1366 Documentation is on Sphinx.
1367
1368 .. change::
1369 :tags:
1370 :tickets: 154
1371
1372 Beaker is now part of "extras" in
1373 setup.py instead of "install_requires".
1374 This to produce a lighter weight install
1375 for those who don't use the caching
1376 as well as to conform to Pyramid
1377 deployment practices.
1378
1379 .. change::
1380 :tags:
1381 :tickets: 153
1382
1383 The Beaker import (or attempt thereof)
1384 is delayed until actually needed;
1385 this to remove the performance penalty
1386 from startup, particularly for
1387 "single execution" environments
1388 such as shell scripts.
1389
1390 .. change::
1391 :tags:
1392 :tickets: 155
1393
1394 Patch to lexer to not generate an empty
1395 '' write in the case of backslash-ended
1396 lines.
1397
1398 .. change::
1399 :tags:
1400 :tickets: 148
1401
Mike Bayer7553fb82019-08-01 12:13:22 -04001402 Fixed missing \**extra collection in
Mike Bayerbf98abb2014-01-09 19:22:41 -05001403 setup.py which prevented setup.py
1404 from running 2to3 on install.
1405
1406 .. change::
1407 :tags:
1408 :tickets:
1409
1410 New flag on Template, TemplateLookup -
1411 strict_undefined=True, will cause
1412 variables not found in the context to
1413 raise a NameError immediately, instead of
1414 defaulting to the UNDEFINED value.
1415
1416 .. change::
1417 :tags:
1418 :tickets:
1419
1420 The range of Python identifiers that
1421 are considered "undefined", meaning they
1422 are pulled from the context, has been
1423 trimmed back to not include variables
1424 declared inside of expressions (i.e. from
1425 list comprehensions), as well as
1426 in the argument list of lambdas. This
1427 to better support the strict_undefined
1428 feature. The change should be
1429 fully backwards-compatible but involved
1430 a little bit of tinkering in the AST code,
1431 which hadn't really been touched for
1432 a couple of years, just FYI.
1433
1434.. changelog::
1435 :version: 0.3.5
1436 :released: Sun Oct 24 2010
1437
1438 .. change::
1439 :tags:
1440 :tickets: 141
1441
1442 The <%namespace> tag allows expressions
1443 for the `file` argument, i.e. with ${}.
1444 The `context` variable, if needed,
1445 must be referenced explicitly.
1446
1447 .. change::
1448 :tags:
1449 :tickets:
1450
1451 ${} expressions embedded in tags,
1452 such as <%foo:bar x="${...}">, now
1453 allow multiline Python expressions.
1454
1455 .. change::
1456 :tags:
1457 :tickets:
1458
1459 Fixed previously non-covered regular
1460 expression, such that using a ${} expression
1461 inside of a tag element that doesn't allow
1462 them raises a CompileException instead of
1463 silently failing.
1464
1465 .. change::
1466 :tags:
1467 :tickets: 151
1468
1469 Added a try/except around "import markupsafe".
1470 This to support GAE which can't run markupsafe. No idea whatsoever if the
1471 install_requires in setup.py also breaks GAE,
1472 couldn't get an answer on this.
1473
1474.. changelog::
1475 :version: 0.3.4
1476 :released: Tue Jun 22 2010
1477
1478 .. change::
1479 :tags:
1480 :tickets:
1481
1482 Now using MarkupSafe for HTML escaping,
1483 i.e. in place of cgi.escape(). Faster
1484 C-based implementation and also escapes
1485 single quotes for additional security.
1486 Supports the __html__ attribute for
1487 the given expression as well.
1488
1489 When using "disable_unicode" mode,
1490 a pure Python HTML escaper function
1491 is used which also quotes single quotes.
1492
1493 Note that Pylons by default doesn't
1494 use Mako's filter - check your
1495 environment.py file.
1496
1497 .. change::
1498 :tags:
1499 :tickets: 137
1500
1501 Fixed call to "unicode.strip" in
1502 exceptions.text_error_template which
1503 is not Py3k compatible.
1504
1505.. changelog::
1506 :version: 0.3.3
1507 :released: Mon May 31 2010
1508
1509 .. change::
1510 :tags:
1511 :tickets: 135
1512
1513 Added conditional to RichTraceback
1514 such that if no traceback is passed
1515 and sys.exc_info() has been reset,
1516 the formatter just returns blank
1517 for the "traceback" portion.
1518
1519 .. change::
1520 :tags:
1521 :tickets: 131
1522
1523 Fixed sometimes incorrect usage of
1524 exc.__class__.__name__
1525 in html/text error templates when using
1526 Python 2.4
1527
1528 .. change::
1529 :tags:
1530 :tickets:
1531
1532 Fixed broken @property decorator on
1533 template.last_modified
1534
1535 .. change::
1536 :tags:
1537 :tickets: 132
1538
1539 Fixed error formatting when a stacktrace
1540 line contains no line number, as in when
1541 inside an eval/exec-generated function.
1542
1543 .. change::
1544 :tags:
1545 :tickets:
1546
1547 When a .py is being created, the tempfile
1548 where the source is stored temporarily is
1549 now made in the same directory as that of
1550 the .py file. This ensures that the two
1551 files share the same filesystem, thus
1552 avoiding cross-filesystem synchronization
1553 issues. Thanks to Charles Cazabon.
1554
1555.. changelog::
1556 :version: 0.3.2
1557 :released: Thu Mar 11 2010
1558
1559 .. change::
1560 :tags:
1561 :tickets: 116
1562
1563 Calling a def from the top, via
1564 template.get_def(...).render() now checks the
1565 argument signature the same way as it did in
1566 0.2.5, so that TypeError is not raised.
1567 reopen of
1568
1569.. changelog::
1570 :version: 0.3.1
1571 :released: Sun Mar 7 2010
1572
1573 .. change::
1574 :tags:
1575 :tickets: 129
1576
1577 Fixed incorrect dir name in setup.py
1578
1579.. changelog::
1580 :version: 0.3.0
1581 :released: Fri Mar 5 2010
1582
1583 .. change::
1584 :tags:
1585 :tickets: 123
1586
1587 Python 2.3 support is dropped.
1588
1589 .. change::
1590 :tags:
1591 :tickets: 119
1592
1593 Python 3 support is added ! See README.py3k
1594 for installation and testing notes.
1595
1596 .. change::
1597 :tags:
1598 :tickets: 127
1599
1600 Unit tests now run with nose.
1601
1602 .. change::
1603 :tags:
1604 :tickets: 99
1605
1606 Source code escaping has been simplified.
1607 In particular, module source files are now
1608 generated with the Python "magic encoding
1609 comment", and source code is passed through
1610 mostly unescaped, except for that code which
1611 is regenerated from parsed Python source.
1612 This fixes usage of unicode in
1613 <%namespace:defname> tags.
1614
1615 .. change::
1616 :tags:
1617 :tickets: 122
1618
1619 RichTraceback(), html_error_template().render(),
1620 text_error_template().render() now accept "error"
1621 and "traceback" as optional arguments, and
1622 these are now actually used.
1623
1624 .. change::
1625 :tags:
1626 :tickets:
1627
1628 The exception output generated when
1629 format_exceptions=True will now be as a Python
1630 unicode if it occurred during render_unicode(),
1631 or an encoded string if during render().
1632
1633 .. change::
1634 :tags:
1635 :tickets: 112
1636
1637 A percent sign can be emitted as the first
1638 non-whitespace character on a line by escaping
1639 it as in "%%".
1640
1641 .. change::
1642 :tags:
1643 :tickets: 94
1644
1645 Template accepts empty control structure, i.e.
1646 % if: %endif, etc.
1647
1648 .. change::
1649 :tags:
1650 :tickets: 116
1651
1652 The <%page args> tag can now be used in a base
1653 inheriting template - the full set of render()
1654 arguments are passed down through the inherits
Mike Bayer7553fb82019-08-01 12:13:22 -04001655 chain. Undeclared arguments go into \**pageargs
Mike Bayerbf98abb2014-01-09 19:22:41 -05001656 as usual.
1657
1658 .. change::
1659 :tags:
1660 :tickets: 109
1661
1662 defs declared within a <%namespace> section, an
1663 uncommon feature, have been improved. The defs
1664 no longer get doubly-rendered in the body() scope,
1665 and now allow local variable assignment without
1666 breakage.
1667
1668 .. change::
1669 :tags:
1670 :tickets: 128
1671
1672 Windows paths are handled correctly if a Template
1673 is passed only an absolute filename (i.e. with c:
1674 drive etc.) and no URI - the URI is converted
1675 to a forward-slash path and module_directory
1676 is treated as a windows path.
1677
1678 .. change::
1679 :tags:
1680 :tickets: 73
1681
1682 TemplateLookup raises TopLevelLookupException for
1683 a given path that is a directory, not a filename,
1684 instead of passing through to the template to
1685 generate IOError.
1686
1687
1688.. changelog::
1689 :version: 0.2.6
1690 :released:
1691
1692 .. change::
1693 :tags:
1694 :tickets:
1695
1696 Fix mako function decorators to preserve the
1697 original function's name in all cases. Patch
1698 from Scott Torborg.
1699
1700 .. change::
1701 :tags:
1702 :tickets: 118
1703
1704 Support the <%namespacename:defname> syntax in
1705 the babel extractor.
1706
1707 .. change::
1708 :tags:
1709 :tickets: 88
1710
1711 Further fixes to unicode handling of .py files with the
1712 html_error_template.
1713
1714.. changelog::
1715 :version: 0.2.5
1716 :released: Mon Sep 7 2009
1717
1718 .. change::
1719 :tags:
1720 :tickets:
1721
1722 Added a "decorator" kw argument to <%def>,
1723 allows custom decoration functions to wrap
1724 rendering callables. Mainly intended for
1725 custom caching algorithms, not sure what
1726 other uses there may be (but there may be).
1727 Examples are in the "filtering" docs.
1728
1729 .. change::
1730 :tags:
1731 :tickets: 101
1732
1733 When Mako creates subdirectories in which
1734 to store templates, it uses the more
1735 permissive mode of 0775 instead of 0750,
1736 helping out with certain multi-process
1737 scenarios. Note that the mode is always
1738 subject to the restrictions of the existing
1739 umask.
1740
1741 .. change::
1742 :tags:
1743 :tickets: 104
1744
1745 Fixed namespace.__getattr__() to raise
1746 AttributeError on attribute not found
1747 instead of RuntimeError.
1748
1749 .. change::
1750 :tags:
1751 :tickets: 97
1752
1753 Added last_modified accessor to Template,
1754 returns the time.time() when the module
1755 was created.
1756
1757 .. change::
1758 :tags:
1759 :tickets: 102
1760
1761 Fixed lexing support for whitespace
1762 around '=' sign in defs.
1763
1764 .. change::
1765 :tags:
1766 :tickets: 108
1767
1768 Removed errant "lower()" in the lexer which
1769 was causing tags to compile with
1770 case-insensitive names, thus messing up
1771 custom <%call> names.
1772
1773 .. change::
1774 :tags:
1775 :tickets: 110
1776
1777 added "mako.__version__" attribute to
1778 the base module.
1779
1780.. changelog::
1781 :version: 0.2.4
1782 :released: Tue Dec 23 2008
1783
1784 .. change::
1785 :tags:
1786 :tickets:
1787
1788 Fixed compatibility with Jython 2.5b1.
1789
1790.. changelog::
1791 :version: 0.2.3
1792 :released: Sun Nov 23 2008
1793
1794 .. change::
1795 :tags:
1796 :tickets:
1797
1798 the <%namespacename:defname> syntax described at
1799 http://techspot.zzzeek.org/?p=28 has now
1800 been added as a built in syntax, and is recommended
1801 as a more modern syntax versus <%call expr="expression">.
1802 The %call tag itself will always remain,
1803 with <%namespacename:defname> presenting a more HTML-like
1804 alternative to calling defs, both plain and
1805 nested. Many examples of the new syntax are in the
1806 "Calling a def with embedded content" section
1807 of the docs.
1808
1809 .. change::
1810 :tags:
1811 :tickets:
1812
1813 added support for Jython 2.5.
1814
1815 .. change::
1816 :tags:
1817 :tickets:
1818
1819 cache module now uses Beaker's CacheManager
1820 object directly, so that all cache types are included.
1821 memcached is available as both "ext:memcached" and
1822 "memcached", the latter for backwards compatibility.
1823
1824 .. change::
1825 :tags:
1826 :tickets:
1827
1828 added "cache" accessor to Template, Namespace.
1829 e.g. ${local.cache.get('somekey')} or
1830 template.cache.invalidate_body()
1831
1832 .. change::
1833 :tags:
1834 :tickets:
1835
1836 added "cache_enabled=True" flag to Template,
1837 TemplateLookup. Setting this to False causes cache
1838 operations to "pass through" and execute every time;
1839 this flag should be integrated in Pylons with its own
1840 cache_enabled configuration setting.
1841
1842 .. change::
1843 :tags:
1844 :tickets: 92
1845
1846 the Cache object now supports invalidate_def(name),
1847 invalidate_body(), invalidate_closure(name),
1848 invalidate(key), which will remove the given key
1849 from the cache, if it exists. The cache arguments
1850 (i.e. storage type) are derived from whatever has
1851 been already persisted for that template.
1852
1853 .. change::
1854 :tags:
1855 :tickets:
1856
1857 For cache changes to work fully, Beaker 1.1 is required.
1858 1.0.1 and up will work as well with the exception of
1859 cache expiry. Note that Beaker 1.1 is **required**
1860 for applications which use dynamically generated keys,
1861 since previous versions will permanently store state in memory
1862 for each individual key, thus consuming all available
1863 memory for an arbitrarily large number of distinct
1864 keys.
1865
1866 .. change::
1867 :tags:
1868 :tickets: 93
1869
1870 fixed bug whereby an <%included> template with
1871 <%page> args named the same as a __builtin__ would not
1872 honor the default value specified in <%page>
1873
1874 .. change::
1875 :tags:
1876 :tickets: 88
1877
1878 fixed the html_error_template not handling tracebacks from
1879 normal .py files with a magic encoding comment
1880
1881 .. change::
1882 :tags:
1883 :tickets:
1884
1885 RichTraceback() now accepts an optional traceback object
1886 to be used in place of sys.exc_info()[2]. html_error_template()
1887 and text_error_template() accept an optional
1888 render()-time argument "traceback" which is passed to the
1889 RichTraceback object.
1890
1891 .. change::
1892 :tags:
1893 :tickets:
1894
1895 added ModuleTemplate class, which allows the construction
1896 of a Template given a Python module generated by a previous
1897 Template. This allows Python modules alone to be used
1898 as templates with no compilation step. Source code
1899 and template source are optional but allow error reporting
1900 to work correctly.
1901
1902 .. change::
1903 :tags:
1904 :tickets: 90
1905
1906 fixed Python 2.3 compat. in mako.pyparser
1907
1908 .. change::
1909 :tags:
1910 :tickets:
1911
1912 fix Babel 0.9.3 compatibility; stripping comment tags is now
1913 optional (and enabled by default).
1914
1915.. changelog::
1916 :version: 0.2.2
1917 :released: Mon Jun 23 2008
1918
1919 .. change::
1920 :tags:
1921 :tickets: 87
1922
1923 cached blocks now use the current context when rendering
1924 an expired section, instead of the original context
1925 passed in
1926
1927 .. change::
1928 :tags:
1929 :tickets:
1930
1931 fixed a critical issue regarding caching, whereby
1932 a cached block would raise an error when called within a
1933 cache-refresh operation that was initiated after the
1934 initiating template had completed rendering.
1935
1936.. changelog::
1937 :version: 0.2.1
1938 :released: Mon Jun 16 2008
1939
1940 .. change::
1941 :tags:
1942 :tickets:
1943
1944 fixed bug where 'output_encoding' parameter would prevent
1945 render_unicode() from returning a unicode object.
1946
1947 .. change::
1948 :tags:
1949 :tickets:
1950
1951 bumped magic number, which forces template recompile for
1952 this version (fixes incompatible compile symbols from 0.1
1953 series).
1954
1955 .. change::
1956 :tags:
1957 :tickets:
1958
1959 added a few docs for cache options, specifically those that
1960 help with memcached.
1961
1962.. changelog::
1963 :version: 0.2.0
1964 :released: Tue Jun 3 2008
1965
1966 .. change::
1967 :tags:
1968 :tickets:
1969
1970 Speed improvements (as though we needed them, but people
1971 contributed and there you go):
1972
1973 .. change::
1974 :tags:
1975 :tickets: 77
1976
1977 added "bytestring passthru" mode, via
1978 `disable_unicode=True` argument passed to Template or
1979 TemplateLookup. All unicode-awareness and filtering is
1980 turned off, and template modules are generated with
1981 the appropriate magic encoding comment. In this mode,
1982 template expressions can only receive raw bytestrings
1983 or Unicode objects which represent straight ASCII, and
1984 render_unicode() may not be used if multibyte
1985 characters are present. When enabled, speed
1986 improvement around 10-20%. (courtesy
1987 anonymous guest)
1988
1989 .. change::
1990 :tags:
1991 :tickets: 76
1992
1993 inlined the "write" function of Context into a local
1994 template variable. This affords a 12-30% speedup in
1995 template render time. (idea courtesy same anonymous
1996 guest)
1997
1998 .. change::
1999 :tags:
2000 :tickets:
2001
2002 New Features, API changes:
2003
2004 .. change::
2005 :tags:
2006 :tickets: 62
2007
2008 added "attr" accessor to namespaces. Returns
2009 attributes configured as module level attributes, i.e.
Mike Bayer7553fb82019-08-01 12:13:22 -04002010 within <%! %> sections. i.e.::
Mike Bayerbf98abb2014-01-09 19:22:41 -05002011
Mike Bayer7553fb82019-08-01 12:13:22 -04002012 # somefile.html
2013 <%!
2014 foo = 27
2015 %>
Mike Bayerbf98abb2014-01-09 19:22:41 -05002016
Mike Bayer7553fb82019-08-01 12:13:22 -04002017 # some other template
2018 <%namespace name="myns" file="somefile.html"/>
2019 ${myns.attr.foo}
Mike Bayerbf98abb2014-01-09 19:22:41 -05002020
2021 The slight backwards incompatibility here is, you
2022 can't have namespace defs named "attr" since the
2023 "attr" descriptor will occlude it.
2024
2025 .. change::
2026 :tags:
2027 :tickets: 78
2028
2029 cache_key argument can now render arguments passed
2030 directly to the %page or %def, i.e. <%def
2031 name="foo(x)" cached="True" cache_key="${x}"/>
2032
2033 .. change::
2034 :tags:
2035 :tickets:
2036
2037 some functions on Context are now private:
2038 _push_buffer(), _pop_buffer(),
2039 caller_stack._push_frame(), caller_stack._pop_frame().
2040
2041 .. change::
2042 :tags:
2043 :tickets: 56, 81
2044
2045 added a runner script "mako-render" which renders
2046 standard input as a template to stdout
2047
2048 .. change::
2049 :tags: bugfixes
2050 :tickets: 83, 84
2051
2052 can now use most names from __builtins__ as variable
2053 names without explicit declaration (i.e. 'id',
2054 'exception', 'range', etc.)
2055
2056 .. change::
2057 :tags: bugfixes
2058 :tickets: 84
2059
2060 can also use builtin names as local variable names
2061 (i.e. dict, locals) (came from fix for)
2062
2063 .. change::
2064 :tags: bugfixes
2065 :tickets: 68
2066
2067 fixed bug in python generation when variable names are
2068 used with identifiers like "else", "finally", etc.
2069 inside them
2070
2071 .. change::
2072 :tags: bugfixes
2073 :tickets: 69
2074
Ville Skyttä317d3002017-05-11 12:48:13 +03002075 fixed codegen bug which occurred when using <%page>
Mike Bayerbf98abb2014-01-09 19:22:41 -05002076 level caching, combined with an expression-based
2077 cache_key, combined with the usage of <%namespace
2078 import="*"/> - fixed lexer exceptions not cleaning up
2079 temporary files, which could lead to a maximum number
2080 of file descriptors used in the process
2081
2082 .. change::
2083 :tags: bugfixes
2084 :tickets: 71
2085
2086 fixed issue with inline format_exceptions that was
2087 producing blank exception pages when an inheriting
2088 template is present
2089
2090 .. change::
2091 :tags: bugfixes
2092 :tickets:
2093
2094 format_exceptions will apply the encoding options of
2095 html_error_template() to the buffered output
2096
2097 .. change::
2098 :tags: bugfixes
2099 :tickets: 75
2100
2101 rewrote the "whitespace adjuster" function to work
2102 with more elaborate combinations of quotes and
2103 comments
2104
2105
2106.. changelog::
2107 :version: 0.1.10
2108 :released:
2109
2110 .. change::
2111 :tags:
2112 :tickets:
2113
2114 fixed propagation of 'caller' such that nested %def calls
2115 within a <%call> tag's argument list propigates 'caller'
2116 to the %call function itself (propigates to the inner
2117 calls too, this is a slight side effect which previously
2118 existed anyway)
2119
2120 .. change::
2121 :tags:
2122 :tickets:
2123
2124 fixed bug where local.get_namespace() could put an
2125 incorrect "self" in the current context
2126
2127 .. change::
2128 :tags:
2129 :tickets:
2130
2131 fixed another namespace bug where the namespace functions
2132 did not have access to the correct context containing
2133 their 'self' and 'parent'
2134
2135.. changelog::
2136 :version: 0.1.9
2137 :released:
2138
2139 .. change::
2140 :tags:
2141 :tickets: 47
2142
2143 filters.Decode filter can also accept a non-basestring
2144 object and will call str() + unicode() on it
2145
2146 .. change::
2147 :tags:
2148 :tickets: 53
2149
2150 comments can be placed at the end of control lines,
2151 i.e. if foo: # a comment,, thanks to
2152 Paul Colomiets
2153
2154 .. change::
2155 :tags:
2156 :tickets: 16
2157
2158 fixed expressions and page tag arguments and with embedded
2159 newlines in CRLF templates, follow up to, thanks
2160 Eric Woroshow
2161
2162 .. change::
2163 :tags:
2164 :tickets: 51
2165
2166 added an IOError catch for source file not found in RichTraceback
2167 exception reporter
2168
2169.. changelog::
2170 :version: 0.1.8
2171 :released: Tue Jun 26 2007
2172
2173 .. change::
2174 :tags:
2175 :tickets:
2176
2177 variable names declared in render methods by internal
2178 codegen prefixed by "__M_" to prevent name collisions
2179 with user code
2180
2181 .. change::
2182 :tags:
2183 :tickets: 45
2184
2185 added a Babel (http://babel.edgewall.org/) extractor entry
2186 point, allowing extraction of gettext messages directly from
2187 mako templates via Babel
2188
2189 .. change::
2190 :tags:
2191 :tickets:
2192
2193 fix to turbogears plugin to work with dot-separated names
2194 (i.e. load_template('foo.bar')). also takes file extension
2195 as a keyword argument (default is 'mak').
2196
2197 .. change::
2198 :tags:
2199 :tickets: 35
2200
2201 more tg fix: fixed, allowing string-based
2202 templates with tgplugin even if non-compatible args were sent
2203
2204.. changelog::
2205 :version: 0.1.7
2206 :released: Wed Jun 13 2007
2207
2208 .. change::
2209 :tags:
2210 :tickets:
2211
2212 one small fix to the unit tests to support python 2.3
2213
2214 .. change::
2215 :tags:
2216 :tickets:
2217
2218 a slight hack to how cache.py detects Beaker's memcached,
2219 works around unexplained import behavior observed on some
2220 python 2.3 installations
2221
2222.. changelog::
2223 :version: 0.1.6
2224 :released: Fri May 18 2007
2225
2226 .. change::
2227 :tags:
2228 :tickets:
2229
2230 caching is now supplied directly by Beaker, which has
2231 all of MyghtyUtils merged into it now. The latest Beaker
2232 (0.7.1) also fixes a bug related to how Mako was using the
2233 cache API.
2234
2235 .. change::
2236 :tags:
2237 :tickets: 34
2238
2239 fix to module_directory path generation when the path is "./"
2240
2241 .. change::
2242 :tags:
2243 :tickets: 35
2244
2245 TGPlugin passes options to string-based templates
2246
2247 .. change::
2248 :tags:
2249 :tickets: 28
2250
2251 added an explicit stack frame step to template runtime, which
2252 allows much simpler and hopefully bug-free tracking of 'caller',
2253 fixes
2254
2255 .. change::
2256 :tags:
2257 :tickets:
2258
2259 if plain Python defs are used with <%call>, a decorator
2260 @runtime.supports_callable exists to ensure that the "caller"
2261 stack is properly handled for the def.
2262
2263 .. change::
2264 :tags:
2265 :tickets: 37
2266
2267 fix to RichTraceback and exception reporting to get template
2268 source code as a unicode object
2269
2270 .. change::
2271 :tags:
2272 :tickets: 39
2273
2274 html_error_template includes options "full=True", "css=True"
2275 which control generation of HTML tags, CSS
2276
2277 .. change::
2278 :tags:
2279 :tickets: 40
2280
2281 added the 'encoding_errors' parameter to Template/TemplateLookup
2282 for specifying the error handler associated with encoding to
2283 'output_encoding'
2284
2285 .. change::
2286 :tags:
2287 :tickets: 37
2288
2289 the Template returned by html_error_template now defaults to
2290 output_encoding=sys.getdefaultencoding(),
2291 encoding_errors='htmlentityreplace'
2292
2293 .. change::
2294 :tags:
2295 :tickets:
2296
2297 control lines, i.e. % lines, support backslashes to continue long
2298 lines (#32)
2299
2300 .. change::
2301 :tags:
2302 :tickets:
2303
2304 fixed codegen bug when defining <%def> within <%call> within <%call>
2305
2306 .. change::
2307 :tags:
2308 :tickets:
2309
2310 leading utf-8 BOM in template files is honored according to pep-0263
2311
2312.. changelog::
2313 :version: 0.1.5
2314 :released: Sat Mar 31 2007
2315
2316 .. change::
2317 :tags:
2318 :tickets: 26
2319
2320 AST expression generation - added in just about everything
2321 expression-wise from the AST module
2322
2323 .. change::
2324 :tags:
2325 :tickets: 27
2326
2327 AST parsing, properly detects imports of the form "import foo.bar"
2328
2329 .. change::
2330 :tags:
2331 :tickets:
2332
2333 fix to lexing of <%docs> tag nested in other tags
2334
2335 .. change::
2336 :tags:
2337 :tickets: 29
2338
2339 fix to context-arguments inside of <%include> tag which broke
2340 during 0.1.4
2341
2342 .. change::
2343 :tags:
2344 :tickets:
2345
2346 added "n" filter, disables *all* filters normally applied to an expression
2347 via <%page> or default_filters (but not those within the filter)
2348
2349 .. change::
2350 :tags:
2351 :tickets:
2352
2353 added buffer_filters argument, defines filters applied to the return value
2354 of buffered/cached/filtered %defs, after all filters defined with the %def
2355 itself have been applied. allows the creation of default expression filters
2356 that let the output of return-valued %defs "opt out" of that filtering
2357 via passing special attributes or objects.
2358
2359.. changelog::
2360 :version: 0.1.4
2361 :released: Sat Mar 10 2007
2362
2363 .. change::
2364 :tags:
2365 :tickets:
2366
2367 got defs-within-defs to be cacheable
2368
2369 .. change::
2370 :tags:
2371 :tickets: 23
2372
2373 fixes to code parsing/whitespace adjusting where plain python comments
2374 may contain quote characters
2375
2376 .. change::
2377 :tags:
2378 :tickets:
2379
2380 fix to variable scoping for identifiers only referenced within
2381 functions
2382
2383 .. change::
2384 :tags:
2385 :tickets:
2386
2387 added a path normalization step to lookup so URIs like
2388 "/foo/bar/../etc/../foo" pre-process the ".." tokens before checking
2389 the filesystem
2390
2391 .. change::
2392 :tags:
2393 :tickets:
2394
2395 fixed/improved "caller" semantics so that undefined caller is
2396 "UNDEFINED", propigates __nonzero__ method so it evaulates to False if
2397 not present, True otherwise. this way you can say % if caller:\n
2398 ${caller.body()}\n% endif
2399
2400 .. change::
2401 :tags:
2402 :tickets:
2403
2404 <%include> has an "args" attribute that can pass arguments to the
2405 called template (keyword arguments only, must be declared in that
2406 page's <%page> tag.)
2407
2408 .. change::
2409 :tags:
2410 :tickets:
2411
2412 <%include> plus arguments is also programmatically available via
Mike Bayer7553fb82019-08-01 12:13:22 -04002413 self.include_file(<filename>, \**kwargs)
Mike Bayerbf98abb2014-01-09 19:22:41 -05002414
2415 .. change::
2416 :tags:
2417 :tickets: 24
2418
2419 further escaping added for multibyte expressions in %def, %call
2420 attributes
2421
2422.. changelog::
2423 :version: 0.1.3
2424 :released: Wed Feb 21 2007
2425
2426 .. change::
2427 :tags:
2428 :tickets:
2429
2430 ***Small Syntax Change*** - the single line comment character is now
2431 *two* hash signs, i.e. "## this is a comment". This avoids a common
2432 collection with CSS selectors.
2433
2434 .. change::
2435 :tags:
2436 :tickets:
2437
2438 the magic "coding" comment (i.e. # coding:utf-8) will still work with
2439 either one "#" sign or two for now; two is preferred going forward, i.e.
2440 ## coding:<someencoding>.
2441
2442 .. change::
2443 :tags:
2444 :tickets:
2445
2446 new multiline comment form: "<%doc> a comment </%doc>"
2447
2448 .. change::
2449 :tags:
2450 :tickets:
2451
2452 UNDEFINED evaluates to False
2453
2454 .. change::
2455 :tags:
2456 :tickets:
2457
2458 improvement to scoping of "caller" variable when using <%call> tag
2459
2460 .. change::
2461 :tags:
2462 :tickets:
2463
2464 added lexer error for unclosed control-line (%) line
2465
2466 .. change::
2467 :tags:
2468 :tickets:
2469
2470 added "preprocessor" argument to Template, TemplateLookup - is a single
2471 callable or list of callables which will be applied to the template text
2472 before lexing. given the text as an argument, returns the new text.
2473
2474 .. change::
2475 :tags:
2476 :tickets:
2477
2478 added mako.ext.preprocessors package, contains one preprocessor so far:
2479 'convert_comments', which will convert single # comments to the new ##
2480 format
2481
2482.. changelog::
2483 :version: 0.1.2
2484 :released: Thu Feb 1 2007
2485
2486 .. change::
2487 :tags:
2488 :tickets: 11
2489
2490 fix to parsing of code/expression blocks to insure that non-ascii
2491 characters, combined with a template that indicates a non-standard
2492 encoding, are expanded into backslash-escaped glyphs before being AST
2493 parsed
2494
2495 .. change::
2496 :tags:
2497 :tickets:
2498
2499 all template lexing converts the template to unicode first, to
2500 immediately catch any encoding issues and ensure internal unicode
2501 representation.
2502
2503 .. change::
2504 :tags:
2505 :tickets:
2506
2507 added module_filename argument to Template to allow specification of a
2508 specific module file
2509
2510 .. change::
2511 :tags:
2512 :tickets: 14
2513
2514 added modulename_callable to TemplateLookup to allow a function to
2515 determine module filenames (takes filename, uri arguments). used for
2516
2517 .. change::
2518 :tags:
2519 :tickets:
2520
2521 added optional input_encoding flag to Template, to allow sending a
2522 unicode() object with no magic encoding comment
2523
2524 .. change::
2525 :tags:
2526 :tickets:
2527
2528 "expression_filter" argument in <%page> applies only to expressions
2529
2530 .. change::
2531 :tags: "unicode"
2532 :tickets:
2533
2534 added "default_filters" argument to Template, TemplateLookup. applies only
2535 to expressions, gets prepended to "expression_filter" arg from <%page>.
2536 defaults to, so that all expressions get stringified into u''
2537 by default (this is what Mako already does). By setting to [], expressions
2538 are passed through raw.
2539
2540 .. change::
2541 :tags:
2542 :tickets:
2543
2544 added "imports" argument to Template, TemplateLookup. so you can predefine
2545 a list of import statements at the top of the template. can be used in
2546 conjunction with default_filters.
2547
2548 .. change::
2549 :tags:
2550 :tickets: 16
2551
2552 support for CRLF templates...whoops ! welcome to all the windows users.
2553
2554 .. change::
2555 :tags:
2556 :tickets:
2557
2558 small fix to local variable propigation for locals that are conditionally
2559 declared
2560
2561 .. change::
2562 :tags:
2563 :tickets:
2564
2565 got "top level" def calls to work, i.e. template.get_def("somedef").render()
2566
2567.. changelog::
2568 :version: 0.1.1
2569 :released: Sun Jan 14 2007
2570
2571 .. change::
2572 :tags:
2573 :tickets: 8
2574
2575 buffet plugin supports string-based templates, allows ToscaWidgets to work
2576
2577 .. change::
2578 :tags:
2579 :tickets:
2580
2581 AST parsing fixes: fixed TryExcept identifier parsing
2582
2583 .. change::
2584 :tags:
2585 :tickets:
2586
2587 removed textmate tmbundle from contrib and into separate SVN location;
2588 windows users cant handle those files, setuptools not very good at
2589 "pruning" certain directories
2590
2591 .. change::
2592 :tags:
2593 :tickets:
2594
2595 fix so that "cache_timeout" parameter is propigated
2596
2597 .. change::
2598 :tags:
2599 :tickets:
2600
2601 fix to expression filters so that string conversion (actually unicode)
2602 properly occurs before filtering
2603
2604 .. change::
2605 :tags:
2606 :tickets:
2607
2608 better error message when a lookup is attempted with a template that has no
2609 lookup
2610
2611 .. change::
2612 :tags:
2613 :tickets:
2614
2615 implemented "module" attribute for namespace
2616
2617 .. change::
2618 :tags:
2619 :tickets:
2620
2621 fix to code generation to correctly track multiple defs with the same name
2622
2623 .. change::
2624 :tags:
2625 :tickets: 9
2626
2627 "directories" can be passed to TemplateLookup as a scalar in which case it
2628 gets converted to a list