10
:released: Sun Jun 8 2014
16
Improved the error re-raise operation when a custom
17
:paramref:`.Template.error_handler` is used that does not handle
18
the exception; the original stack trace etc. is now preserved.
19
Pull request courtesy Manfred Haltner.
22
:tags: bug, py2k, filters
25
Added an html_escape filter that works in "non unicode" mode.
26
Previously, when using ``disable_unicode=True``, the ``u`` filter
27
would fail to handle non-ASCII bytes properly. Pull request
33
Compatibility changes; in order to modernize the codebase, Mako
34
is now dropping support for Python 2.4 and Python 2.5 altogether.
35
The source base is now targeted at Python 2.6 and forwards.
40
Template modules now generate a JSON "metadata" structure at the bottom
41
of the source file which includes parseable information about the
42
templates' source file, encoding etc. as well as a mapping of module
43
source lines to template lines, thus replacing the "# SOURCE LINE"
44
markers throughout the source code. The structure also indicates those
45
lines that are explicitly not part of the template's source; the goal
46
here is to allow better integration with coverage and other tools.
51
Fixed bug in ``decode.<encoding>`` filter where a non-string object
52
would not be correctly interpreted in Python 3.
58
Fixed bug in Python parsing logic which would fail on Python 3
59
when a "try/except" targeted a tuple of exception types, rather
60
than a single exception.
66
mako-render is now implemented as a setuptools entrypoint script;
67
a standalone mako.cmd.cmdline() callable is now available, and the
68
system also uses argparse now instead of optparse. Pull request
69
courtesy Derek Harland.
75
The mako-render script will now catch exceptions and run them
76
into the text error handler, and exit with a non-zero exit code.
77
Pull request courtesy Derek Harland.
83
A rework of the mako-render script allows the script to run
84
correctly when given a file pathname that is outside of the current
85
directory, e.g. ``mako-render ../some_template.mako``. In this case,
86
the "template root" defaults to the directory in which the template
87
is located, instead of ".". The script also accepts a new argument
88
``--template-dir`` which can be specified multiple times to establish
89
template lookup directories. Standard input for templates also works
90
now too. Pull request courtesy Derek Harland.
96
Support is added for Python 3 "keyword only" arguments, as used in
97
defs. Pull request courtesy Eevee.
105
:released: Thu Dec 26 2013
111
Fixed bug in Babel plugin where translator comments
112
would be lost if intervening text nodes were encountered.
113
Fix courtesy Ned Batchelder.
119
Fixed TGPlugin.render method to support unicode template
120
names in Py2K - courtesy Vladimir Magamedov.
126
Fixed an AST issue that was preventing correct operation
127
under alpha versions of Python 3.4. Pullreq courtesy Zer0-.
133
Changed the format of the "source encoding" header output
134
by the code generator to use the format ``# -*- coding:%s -*-``
135
instead of ``# -*- encoding:%s -*-``; the former is more common
136
and compatible with emacs. Courtesy Martin Geisler.
142
Fixed issue where an old lexer rule prevented a template line
143
which looked like "#*" from being correctly parsed.
147
:released: Tue Aug 27 2013
153
The Context.locals_() method becomes a private underscored
154
method, as this method has a specific internal use. The purpose
155
of Context.kwargs has been clarified, in that it only delivers
156
top level keyword arguments originally passed to template.render().
162
Fixed the babel plugin to properly interpret ${} sections
163
inside of a "call" tag, i.e. <%self:some_tag attr="${_('foo')}"/>.
164
Code that's subject to babel escapes in here needs to be
165
specified as a Python expression, not a literal. This change
166
is backwards incompatible vs. code that is relying upon a _('')
167
translation to be working within a call tag.
173
The Babel plugin has been repaired to work on Python 3.
179
Using <%namespace import="*" module="somemodule"/> now
180
skips over module elements that are not explcitly callable,
181
avoiding TypeError when trying to produce partials.
187
Fixed Py3K bug where a "lambda" expression was not
188
interpreted correctly within a template tag; also
196
:released: Fri May 24 2013
202
Changed setup.py to skip installing markupsafe
203
if Python version is < 2.6 or is between 3.0 and
204
less than 3.3, as Markupsafe now only supports 2.6->2.X,
211
Fixed regression where "entity" filter wasn't
212
converted for py3k properly (added tests.)
218
Fixed bug where mako-render script wasn't
219
compatible with Py3k.
225
Cleaned up all the various deprecation/
226
file warnings when running the tests under
227
various Pythons with warnings turned on.
231
:released: Wed Apr 10 2013
237
Performance improvement to the
238
"legacy" HTML escape feature, used for XML
239
escaping and when markupsafe isn't present,
246
Fixed bug whereby an exception in Python 3
247
against a module compiled to the filesystem would
248
fail trying to produce a RichTraceback due to the
249
content being in bytes.
255
Change default for compile()->reserved_names
256
from tuple to frozenset, as this is expected to be
263
Code has been reworked to support Python 2.4->
264
Python 3.xx in place. 2to3 no longer needed.
270
Added lexer_cls argument to Template,
271
TemplateLookup, allows alternate Lexer classes
278
Added future_imports parameter to Template
279
and TemplateLookup, renders the __future__ header
280
with desired capabilities at the top of the generated
281
template module. Courtesy Ben Trofatter.
288
:released: Wed Nov 7 2012
294
legacy_html_escape function, used when
295
Markupsafe isn't installed, was using an inline-compiled
296
regexp which causes major slowdowns on Python 3.3;
303
AST supporting now supports tuple-packed
304
function arguments inside pure-python def
305
or lambda expressions.
311
Fixed Py3K bug in the Babel extension.
317
Fixed the "filter" attribute of the
318
<%text> tag so that it pulls locally specified
319
identifiers from the context the same
320
way as that of <%block> and <%filter>.
326
Fixed bug in plugin loader to correctly
327
raise exception when non-existent plugin
332
:released: Fri Jul 20 2012
338
Fixed regression in 0.7.1 where AST
339
parsing for Py2.4 was broken.
343
:released: Sun Jul 8 2012
349
Control lines with no bodies will
350
now succeed, as "pass" is added for these
351
when no statements are otherwise present.
352
Courtesy Ben Trofatter
358
Fixed some long-broken scoping behavior
359
involving variables declared in defs and such,
360
which only became apparent when
361
the strict_undefined flag was turned on.
367
Can now use strict_undefined at the
368
same time args passed to def() are used
369
by other elements of the <%def> tag.
373
:released: Fri Mar 30 2012
379
Added new "loop" variable to templates,
380
is provided within a % for block to provide
381
info about the loop such as index, first/last,
382
odd/even, etc. A migration path is also provided
383
for legacy templates via the "enable_loop" argument
384
available on Template, TemplateLookup, and <%page>.
385
Thanks to Ben Trofatter for all
392
Added a real check for "reserved"
393
names, that is names which are never pulled
394
from the context and cannot be passed to
395
the template.render() method. Current names
396
are "context", "loop", "UNDEFINED".
402
The html_error_template() will now
403
apply Pygments highlighting to the source
404
code displayed in the traceback, if Pygments
405
if available. Courtesy Ben Trofatter
411
Added support for context managers,
412
i.e. "% with x as e:/ % endwith" support.
413
Courtesy Ben Trofatter
419
Added class-level flag to CacheImpl
420
"pass_context"; when True, the keyword argument
421
'context' will be passed to get_or_create()
422
containing the Mako Context object.
428
Fixed some Py3K resource warnings due
429
to filehandles being implicitly closed.
435
Fixed endless recursion bug when
436
nesting multiple def-calls with content.
437
Thanks to Jeff Dairiki.
443
Added Jinja2 to the example
444
benchmark suite, courtesy Vincent Férotin
451
:released: Thu Feb 2 2012
457
The ${{"foo":"bar"}} parsing issue is fixed!!
458
The legendary Eevee has slain the dragon!. Also fixes quoting issue
463
:released: Sat Jan 28 2012
469
Added special compatibility for the 0.5.0
470
Cache() constructor, which was preventing file
471
version checks and not allowing Mako 0.6 to
472
recompile the module files.
476
:released: Sat Jan 21 2012
482
Template caching has been converted into a plugin
483
system, whereby the usage of Beaker is just the
484
default plugin. Template and TemplateLookup
485
now accept a string "cache_impl" parameter which
486
refers to the name of a cache plugin, defaulting
487
to the name 'beaker'. New plugins can be
488
registered as pkg_resources entrypoints under
489
the group "mako.cache", or registered directly
490
using mako.cache.register_plugin(). The
491
core plugin is the mako.cache.CacheImpl
498
Added support for Beaker cache regions
499
in templates. Usage of regions should be considered
500
as superseding the very obsolete idea of passing in
501
backend options, timeouts, etc. within templates.
507
The 'put' method on Cache is now
508
'set'. 'put' is there for backwards compatibility.
514
The <%def>, <%block> and <%page> tags now accept
515
any argument named "cache_*", and the key
516
minus the "cache_" prefix will be passed as keyword
517
arguments to the CacheImpl methods.
523
Template and TemplateLookup now accept an argument
524
cache_args, which refers to a dictionary containing
525
cache parameters. The cache_dir, cache_url, cache_type,
526
cache_timeout arguments are deprecated (will probably
527
never be removed, however) and can be passed
528
now as cache_args={'url':<some url>, 'type':'memcached',
529
'timeout':50, 'dir':'/path/to/some/directory'}
535
Can now refer to context variables
536
within extra arguments to <%block>, <%def>, i.e.
537
<%block name="foo" cache_key="${somekey}">.
538
Filters can also be used in this way, i.e.
539
<%def name="foo()" filter="myfilter">
540
then template.render(myfilter=some_callable)
546
Added "--var name=value" option to the mako-render
547
script, allows passing of kw to the template from
554
Added module_writer argument to Template,
555
TemplateLookup, allows a callable to be passed which
556
takes over the writing of the template's module source
557
file, so that special environment-specific steps
564
The exception message in the html_error_template
565
is now escaped with the HTML filter.
571
Added "white-space:pre" style to html_error_template()
572
for code blocks so that indentation is preserved
578
The "benchmark" example is now Python 3 compatible
579
(even though several of those old template libs aren't
580
available on Py3K, so YMMV)
585
:released: Wed Sep 28 2011
591
A Template is explicitly disallowed
592
from having a url that normalizes to relative outside
593
of the root. That is, if the Lookup is based
594
at /home/mytemplates, an include that would place
595
the ultimate template at
596
/home/mytemplates/../some_other_directory,
597
i.e. outside of /home/mytemplates,
598
is disallowed. This usage was never intended
599
despite the lack of an explicit check.
600
The main issue this causes
601
is that module files can be written outside
602
of the module root (or raise an error, if file perms aren't
603
set up), and can also lead to the same template being
604
cached in the lookup under multiple, relative roots.
605
TemplateLookup instead has always supported multiple
606
file roots for this purpose.
611
:released: Fri Aug 5 2011
617
Fixed bug regarding <%call>/def calls w/ content
618
whereby the identity of the "caller" callable
619
inside the <%def> would be corrupted by the
620
presence of another <%call> in the same block.
626
Fixed the babel plugin to accommodate <%block>
630
:released: Wed Apr 6 2011
636
New tag: <%block>. A variant on <%def> that
637
evaluates its contents in-place.
638
Can be named or anonymous,
639
the named version is intended for inheritance
640
layouts where any given section can be
641
surrounded by the <%block> tag in order for
642
it to become overrideable by inheriting
643
templates, without the need to specify a
644
top-level <%def> plus explicit call.
645
Modified scoping and argument rules as well as a
646
more strictly enforced usage scheme make it ideal
647
for this purpose without at all replacing most
648
other things that defs are still good for.
655
a slight adjustment to the "highlight" logic
656
for generating template bound stacktraces.
657
Will stick to known template source lines
658
without any extra guessing.
662
:released: Sun Mar 6 2011
668
A 20% speedup for a basic two-page
669
inheritance setup rendering
670
a table of escaped data
671
(see http://techspot.zzzeek.org/2010/11/19/quick-mako-vs.-jinja-speed-test/).
672
A few configurational changes which
673
affect those in the I-don't-do-unicode
674
camp should be noted below.
680
The FastEncodingBuffer is now used
681
by default instead of cStringIO or StringIO,
682
regardless of whether output_encoding
683
is set to None or not. FEB is faster than
684
both. Only StringIO allows bytestrings
685
of unknown encoding to pass right
686
through, however - while it is of course
687
not recommended to send bytestrings of unknown
688
encoding to the output stream, this
689
mode of usage can be re-enabled by
690
setting the flag bytestring_passthrough
697
disable_unicode mode requires that
698
output_encoding be set to None - it also
699
forces the bytestring_passthrough flag
706
the <%namespace> tag raises an error
707
if the 'template' and 'module' attributes
708
are specified at the same time in
709
one tag. A different class is used
710
for each case which allows a reduction in
711
runtime conditional logic and function
718
the keys() in the Context, as well as
719
it's internal _data dictionary, now
720
include just what was specified to
721
render() as well as Mako builtins
722
'caller', 'capture'. The contents
723
of __builtin__ are no longer copied.
724
Thanks to Daniel Lopez for pointing
730
:released: Sat Nov 13 2010
736
Documentation is on Sphinx.
742
Beaker is now part of "extras" in
743
setup.py instead of "install_requires".
744
This to produce a lighter weight install
745
for those who don't use the caching
746
as well as to conform to Pyramid
747
deployment practices.
753
The Beaker import (or attempt thereof)
754
is delayed until actually needed;
755
this to remove the performance penalty
756
from startup, particularly for
757
"single execution" environments
758
such as shell scripts.
764
Patch to lexer to not generate an empty
765
'' write in the case of backslash-ended
772
Fixed missing **extra collection in
773
setup.py which prevented setup.py
774
from running 2to3 on install.
780
New flag on Template, TemplateLookup -
781
strict_undefined=True, will cause
782
variables not found in the context to
783
raise a NameError immediately, instead of
784
defaulting to the UNDEFINED value.
790
The range of Python identifiers that
791
are considered "undefined", meaning they
792
are pulled from the context, has been
793
trimmed back to not include variables
794
declared inside of expressions (i.e. from
795
list comprehensions), as well as
796
in the argument list of lambdas. This
797
to better support the strict_undefined
798
feature. The change should be
799
fully backwards-compatible but involved
800
a little bit of tinkering in the AST code,
801
which hadn't really been touched for
802
a couple of years, just FYI.
806
:released: Sun Oct 24 2010
812
The <%namespace> tag allows expressions
813
for the `file` argument, i.e. with ${}.
814
The `context` variable, if needed,
815
must be referenced explicitly.
821
${} expressions embedded in tags,
822
such as <%foo:bar x="${...}">, now
823
allow multiline Python expressions.
829
Fixed previously non-covered regular
830
expression, such that using a ${} expression
831
inside of a tag element that doesn't allow
832
them raises a CompileException instead of
839
Added a try/except around "import markupsafe".
840
This to support GAE which can't run markupsafe. No idea whatsoever if the
841
install_requires in setup.py also breaks GAE,
842
couldn't get an answer on this.
846
:released: Tue Jun 22 2010
852
Now using MarkupSafe for HTML escaping,
853
i.e. in place of cgi.escape(). Faster
854
C-based implementation and also escapes
855
single quotes for additional security.
856
Supports the __html__ attribute for
857
the given expression as well.
859
When using "disable_unicode" mode,
860
a pure Python HTML escaper function
861
is used which also quotes single quotes.
863
Note that Pylons by default doesn't
864
use Mako's filter - check your
871
Fixed call to "unicode.strip" in
872
exceptions.text_error_template which
873
is not Py3k compatible.
877
:released: Mon May 31 2010
883
Added conditional to RichTraceback
884
such that if no traceback is passed
885
and sys.exc_info() has been reset,
886
the formatter just returns blank
887
for the "traceback" portion.
893
Fixed sometimes incorrect usage of
894
exc.__class__.__name__
895
in html/text error templates when using
902
Fixed broken @property decorator on
903
template.last_modified
909
Fixed error formatting when a stacktrace
910
line contains no line number, as in when
911
inside an eval/exec-generated function.
917
When a .py is being created, the tempfile
918
where the source is stored temporarily is
919
now made in the same directory as that of
920
the .py file. This ensures that the two
921
files share the same filesystem, thus
922
avoiding cross-filesystem synchronization
923
issues. Thanks to Charles Cazabon.
927
:released: Thu Mar 11 2010
933
Calling a def from the top, via
934
template.get_def(...).render() now checks the
935
argument signature the same way as it did in
936
0.2.5, so that TypeError is not raised.
941
:released: Sun Mar 7 2010
947
Fixed incorrect dir name in setup.py
951
:released: Fri Mar 5 2010
957
Python 2.3 support is dropped.
963
Python 3 support is added ! See README.py3k
964
for installation and testing notes.
970
Unit tests now run with nose.
976
Source code escaping has been simplified.
977
In particular, module source files are now
978
generated with the Python "magic encoding
979
comment", and source code is passed through
980
mostly unescaped, except for that code which
981
is regenerated from parsed Python source.
982
This fixes usage of unicode in
983
<%namespace:defname> tags.
989
RichTraceback(), html_error_template().render(),
990
text_error_template().render() now accept "error"
991
and "traceback" as optional arguments, and
992
these are now actually used.
998
The exception output generated when
999
format_exceptions=True will now be as a Python
1000
unicode if it occurred during render_unicode(),
1001
or an encoded string if during render().
1007
A percent sign can be emitted as the first
1008
non-whitespace character on a line by escaping
1015
Template accepts empty control structure, i.e.
1022
The <%page args> tag can now be used in a base
1023
inheriting template - the full set of render()
1024
arguments are passed down through the inherits
1025
chain. Undeclared arguments go into **pageargs
1032
defs declared within a <%namespace> section, an
1033
uncommon feature, have been improved. The defs
1034
no longer get doubly-rendered in the body() scope,
1035
and now allow local variable assignment without
1042
Windows paths are handled correctly if a Template
1043
is passed only an absolute filename (i.e. with c:
1044
drive etc.) and no URI - the URI is converted
1045
to a forward-slash path and module_directory
1046
is treated as a windows path.
1052
TemplateLookup raises TopLevelLookupException for
1053
a given path that is a directory, not a filename,
1054
instead of passing through to the template to
1066
Fix mako function decorators to preserve the
1067
original function's name in all cases. Patch
1074
Support the <%namespacename:defname> syntax in
1075
the babel extractor.
1081
Further fixes to unicode handling of .py files with the
1082
html_error_template.
1086
:released: Mon Sep 7 2009
1092
Added a "decorator" kw argument to <%def>,
1093
allows custom decoration functions to wrap
1094
rendering callables. Mainly intended for
1095
custom caching algorithms, not sure what
1096
other uses there may be (but there may be).
1097
Examples are in the "filtering" docs.
1103
When Mako creates subdirectories in which
1104
to store templates, it uses the more
1105
permissive mode of 0775 instead of 0750,
1106
helping out with certain multi-process
1107
scenarios. Note that the mode is always
1108
subject to the restrictions of the existing
1115
Fixed namespace.__getattr__() to raise
1116
AttributeError on attribute not found
1117
instead of RuntimeError.
1123
Added last_modified accessor to Template,
1124
returns the time.time() when the module
1131
Fixed lexing support for whitespace
1132
around '=' sign in defs.
1138
Removed errant "lower()" in the lexer which
1139
was causing tags to compile with
1140
case-insensitive names, thus messing up
1141
custom <%call> names.
1147
added "mako.__version__" attribute to
1152
:released: Tue Dec 23 2008
1158
Fixed compatibility with Jython 2.5b1.
1162
:released: Sun Nov 23 2008
1168
the <%namespacename:defname> syntax described at
1169
http://techspot.zzzeek.org/?p=28 has now
1170
been added as a built in syntax, and is recommended
1171
as a more modern syntax versus <%call expr="expression">.
1172
The %call tag itself will always remain,
1173
with <%namespacename:defname> presenting a more HTML-like
1174
alternative to calling defs, both plain and
1175
nested. Many examples of the new syntax are in the
1176
"Calling a def with embedded content" section
1183
added support for Jython 2.5.
1189
cache module now uses Beaker's CacheManager
1190
object directly, so that all cache types are included.
1191
memcached is available as both "ext:memcached" and
1192
"memcached", the latter for backwards compatibility.
1198
added "cache" accessor to Template, Namespace.
1199
e.g. ${local.cache.get('somekey')} or
1200
template.cache.invalidate_body()
1206
added "cache_enabled=True" flag to Template,
1207
TemplateLookup. Setting this to False causes cache
1208
operations to "pass through" and execute every time;
1209
this flag should be integrated in Pylons with its own
1210
cache_enabled configuration setting.
1216
the Cache object now supports invalidate_def(name),
1217
invalidate_body(), invalidate_closure(name),
1218
invalidate(key), which will remove the given key
1219
from the cache, if it exists. The cache arguments
1220
(i.e. storage type) are derived from whatever has
1221
been already persisted for that template.
1227
For cache changes to work fully, Beaker 1.1 is required.
1228
1.0.1 and up will work as well with the exception of
1229
cache expiry. Note that Beaker 1.1 is **required**
1230
for applications which use dynamically generated keys,
1231
since previous versions will permanently store state in memory
1232
for each individual key, thus consuming all available
1233
memory for an arbitrarily large number of distinct
1240
fixed bug whereby an <%included> template with
1241
<%page> args named the same as a __builtin__ would not
1242
honor the default value specified in <%page>
1248
fixed the html_error_template not handling tracebacks from
1249
normal .py files with a magic encoding comment
1255
RichTraceback() now accepts an optional traceback object
1256
to be used in place of sys.exc_info()[2]. html_error_template()
1257
and text_error_template() accept an optional
1258
render()-time argument "traceback" which is passed to the
1259
RichTraceback object.
1265
added ModuleTemplate class, which allows the construction
1266
of a Template given a Python module generated by a previous
1267
Template. This allows Python modules alone to be used
1268
as templates with no compilation step. Source code
1269
and template source are optional but allow error reporting
1276
fixed Python 2.3 compat. in mako.pyparser
1282
fix Babel 0.9.3 compatibility; stripping comment tags is now
1283
optional (and enabled by default).
1287
:released: Mon Jun 23 2008
1293
cached blocks now use the current context when rendering
1294
an expired section, instead of the original context
1301
fixed a critical issue regarding caching, whereby
1302
a cached block would raise an error when called within a
1303
cache-refresh operation that was initiated after the
1304
initiating template had completed rendering.
1308
:released: Mon Jun 16 2008
1314
fixed bug where 'output_encoding' parameter would prevent
1315
render_unicode() from returning a unicode object.
1321
bumped magic number, which forces template recompile for
1322
this version (fixes incompatible compile symbols from 0.1
1329
added a few docs for cache options, specifically those that
1330
help with memcached.
1334
:released: Tue Jun 3 2008
1340
Speed improvements (as though we needed them, but people
1341
contributed and there you go):
1347
added "bytestring passthru" mode, via
1348
`disable_unicode=True` argument passed to Template or
1349
TemplateLookup. All unicode-awareness and filtering is
1350
turned off, and template modules are generated with
1351
the appropriate magic encoding comment. In this mode,
1352
template expressions can only receive raw bytestrings
1353
or Unicode objects which represent straight ASCII, and
1354
render_unicode() may not be used if multibyte
1355
characters are present. When enabled, speed
1356
improvement around 10-20%. (courtesy
1363
inlined the "write" function of Context into a local
1364
template variable. This affords a 12-30% speedup in
1365
template render time. (idea courtesy same anonymous
1372
New Features, API changes:
1378
added "attr" accessor to namespaces. Returns
1379
attributes configured as module level attributes, i.e.
1380
within <%! %> sections. i.e.:
1387
# some other template
1388
<%namespace name="myns" file="somefile.html"/>
1391
The slight backwards incompatibility here is, you
1392
can't have namespace defs named "attr" since the
1393
"attr" descriptor will occlude it.
1399
cache_key argument can now render arguments passed
1400
directly to the %page or %def, i.e. <%def
1401
name="foo(x)" cached="True" cache_key="${x}"/>
1407
some functions on Context are now private:
1408
_push_buffer(), _pop_buffer(),
1409
caller_stack._push_frame(), caller_stack._pop_frame().
1415
added a runner script "mako-render" which renders
1416
standard input as a template to stdout
1422
can now use most names from __builtins__ as variable
1423
names without explicit declaration (i.e. 'id',
1424
'exception', 'range', etc.)
1430
can also use builtin names as local variable names
1431
(i.e. dict, locals) (came from fix for)
1437
fixed bug in python generation when variable names are
1438
used with identifiers like "else", "finally", etc.
1445
fixed codegen bug which occured when using <%page>
1446
level caching, combined with an expression-based
1447
cache_key, combined with the usage of <%namespace
1448
import="*"/> - fixed lexer exceptions not cleaning up
1449
temporary files, which could lead to a maximum number
1450
of file descriptors used in the process
1456
fixed issue with inline format_exceptions that was
1457
producing blank exception pages when an inheriting
1464
format_exceptions will apply the encoding options of
1465
html_error_template() to the buffered output
1471
rewrote the "whitespace adjuster" function to work
1472
with more elaborate combinations of quotes and
1484
fixed propagation of 'caller' such that nested %def calls
1485
within a <%call> tag's argument list propigates 'caller'
1486
to the %call function itself (propigates to the inner
1487
calls too, this is a slight side effect which previously
1494
fixed bug where local.get_namespace() could put an
1495
incorrect "self" in the current context
1501
fixed another namespace bug where the namespace functions
1502
did not have access to the correct context containing
1503
their 'self' and 'parent'
1513
filters.Decode filter can also accept a non-basestring
1514
object and will call str() + unicode() on it
1520
comments can be placed at the end of control lines,
1521
i.e. if foo: # a comment,, thanks to
1528
fixed expressions and page tag arguments and with embedded
1529
newlines in CRLF templates, follow up to, thanks
1536
added an IOError catch for source file not found in RichTraceback
1541
:released: Tue Jun 26 2007
1547
variable names declared in render methods by internal
1548
codegen prefixed by "__M_" to prevent name collisions
1555
added a Babel (http://babel.edgewall.org/) extractor entry
1556
point, allowing extraction of gettext messages directly from
1557
mako templates via Babel
1563
fix to turbogears plugin to work with dot-separated names
1564
(i.e. load_template('foo.bar')). also takes file extension
1565
as a keyword argument (default is 'mak').
1571
more tg fix: fixed, allowing string-based
1572
templates with tgplugin even if non-compatible args were sent
1576
:released: Wed Jun 13 2007
1582
one small fix to the unit tests to support python 2.3
1588
a slight hack to how cache.py detects Beaker's memcached,
1589
works around unexplained import behavior observed on some
1590
python 2.3 installations
1594
:released: Fri May 18 2007
1600
caching is now supplied directly by Beaker, which has
1601
all of MyghtyUtils merged into it now. The latest Beaker
1602
(0.7.1) also fixes a bug related to how Mako was using the
1609
fix to module_directory path generation when the path is "./"
1615
TGPlugin passes options to string-based templates
1621
added an explicit stack frame step to template runtime, which
1622
allows much simpler and hopefully bug-free tracking of 'caller',
1629
if plain Python defs are used with <%call>, a decorator
1630
@runtime.supports_callable exists to ensure that the "caller"
1631
stack is properly handled for the def.
1637
fix to RichTraceback and exception reporting to get template
1638
source code as a unicode object
1644
html_error_template includes options "full=True", "css=True"
1645
which control generation of HTML tags, CSS
1651
added the 'encoding_errors' parameter to Template/TemplateLookup
1652
for specifying the error handler associated with encoding to
1659
the Template returned by html_error_template now defaults to
1660
output_encoding=sys.getdefaultencoding(),
1661
encoding_errors='htmlentityreplace'
1667
control lines, i.e. % lines, support backslashes to continue long
1674
fixed codegen bug when defining <%def> within <%call> within <%call>
1680
leading utf-8 BOM in template files is honored according to pep-0263
1684
:released: Sat Mar 31 2007
1690
AST expression generation - added in just about everything
1691
expression-wise from the AST module
1697
AST parsing, properly detects imports of the form "import foo.bar"
1703
fix to lexing of <%docs> tag nested in other tags
1709
fix to context-arguments inside of <%include> tag which broke
1716
added "n" filter, disables *all* filters normally applied to an expression
1717
via <%page> or default_filters (but not those within the filter)
1723
added buffer_filters argument, defines filters applied to the return value
1724
of buffered/cached/filtered %defs, after all filters defined with the %def
1725
itself have been applied. allows the creation of default expression filters
1726
that let the output of return-valued %defs "opt out" of that filtering
1727
via passing special attributes or objects.
1731
:released: Sat Mar 10 2007
1737
got defs-within-defs to be cacheable
1743
fixes to code parsing/whitespace adjusting where plain python comments
1744
may contain quote characters
1750
fix to variable scoping for identifiers only referenced within
1757
added a path normalization step to lookup so URIs like
1758
"/foo/bar/../etc/../foo" pre-process the ".." tokens before checking
1765
fixed/improved "caller" semantics so that undefined caller is
1766
"UNDEFINED", propigates __nonzero__ method so it evaulates to False if
1767
not present, True otherwise. this way you can say % if caller:\n
1768
${caller.body()}\n% endif
1774
<%include> has an "args" attribute that can pass arguments to the
1775
called template (keyword arguments only, must be declared in that
1776
page's <%page> tag.)
1782
<%include> plus arguments is also programmatically available via
1783
self.include_file(<filename>, **kwargs)
1789
further escaping added for multibyte expressions in %def, %call
1794
:released: Wed Feb 21 2007
1800
***Small Syntax Change*** - the single line comment character is now
1801
*two* hash signs, i.e. "## this is a comment". This avoids a common
1802
collection with CSS selectors.
1808
the magic "coding" comment (i.e. # coding:utf-8) will still work with
1809
either one "#" sign or two for now; two is preferred going forward, i.e.
1810
## coding:<someencoding>.
1816
new multiline comment form: "<%doc> a comment </%doc>"
1822
UNDEFINED evaluates to False
1828
improvement to scoping of "caller" variable when using <%call> tag
1834
added lexer error for unclosed control-line (%) line
1840
added "preprocessor" argument to Template, TemplateLookup - is a single
1841
callable or list of callables which will be applied to the template text
1842
before lexing. given the text as an argument, returns the new text.
1848
added mako.ext.preprocessors package, contains one preprocessor so far:
1849
'convert_comments', which will convert single # comments to the new ##
1854
:released: Thu Feb 1 2007
1860
fix to parsing of code/expression blocks to insure that non-ascii
1861
characters, combined with a template that indicates a non-standard
1862
encoding, are expanded into backslash-escaped glyphs before being AST
1869
all template lexing converts the template to unicode first, to
1870
immediately catch any encoding issues and ensure internal unicode
1877
added module_filename argument to Template to allow specification of a
1878
specific module file
1884
added modulename_callable to TemplateLookup to allow a function to
1885
determine module filenames (takes filename, uri arguments). used for
1891
added optional input_encoding flag to Template, to allow sending a
1892
unicode() object with no magic encoding comment
1898
"expression_filter" argument in <%page> applies only to expressions
1904
added "default_filters" argument to Template, TemplateLookup. applies only
1905
to expressions, gets prepended to "expression_filter" arg from <%page>.
1906
defaults to, so that all expressions get stringified into u''
1907
by default (this is what Mako already does). By setting to [], expressions
1908
are passed through raw.
1914
added "imports" argument to Template, TemplateLookup. so you can predefine
1915
a list of import statements at the top of the template. can be used in
1916
conjunction with default_filters.
1922
support for CRLF templates...whoops ! welcome to all the windows users.
1928
small fix to local variable propigation for locals that are conditionally
1935
got "top level" def calls to work, i.e. template.get_def("somedef").render()
1939
:released: Sun Jan 14 2007
1945
buffet plugin supports string-based templates, allows ToscaWidgets to work
1951
AST parsing fixes: fixed TryExcept identifier parsing
1957
removed textmate tmbundle from contrib and into separate SVN location;
1958
windows users cant handle those files, setuptools not very good at
1959
"pruning" certain directories
1965
fix so that "cache_timeout" parameter is propigated
1971
fix to expression filters so that string conversion (actually unicode)
1972
properly occurs before filtering
1978
better error message when a lookup is attempted with a template that has no
1985
implemented "module" attribute for namespace
1991
fix to code generation to correctly track multiple defs with the same name
1997
"directories" can be passed to TemplateLookup as a scalar in which case it
1998
gets converted to a list