1========= 2Changelog 3========= 4 51.0 6=== 7 8.. changelog:: 9 :version: 1.0.14 10 :released: Sat Jul 20 2019 11 12 .. change:: 13 :tags: feature, template 14 15 The ``n`` filter is now supported in the ``<%page>`` tag. This allows a 16 template to omit the default expression filters throughout a whole 17 template, for those cases where a template-wide filter needs to have 18 default filtering disabled. Pull request courtesy Martin von Gagern. 19 20 .. seealso:: 21 22 :ref:`expression_filtering_nfilter` 23 24 25 26 .. change:: 27 :tags: bug, exceptions 28 29 Fixed issue where the correct file URI would not be shown in the 30 template-formatted exception traceback if the template filename were not 31 known. Additionally fixes an issue where stale filenames would be 32 displayed if a stack trace alternated between different templates. Pull 33 request courtesy Martin von Gagern. 34 35 36.. changelog:: 37 :version: 1.0.13 38 :released: Mon Jul 1 2019 39 40 .. change:: 41 :tags: bug, exceptions 42 43 Improved the line-number tracking for source lines inside of Python ``<% 44 ... %>`` blocks, such that text- and HTML-formatted exception traces such 45 as that of :func:`.html_error_template` now report the correct source line 46 inside the block, rather than the first line of the block itself. 47 Exceptions in ``<%! ... %>`` blocks which get raised while loading the 48 module are still not reported correctly, as these are handled before the 49 Mako code is generated. Pull request courtesy Martin von Gagern. 50 51.. changelog:: 52 :version: 1.0.12 53 :released: Wed Jun 5 2019 54 55 .. change:: 56 :tags: bug, py3k 57 :tickets: 296 58 59 Fixed regression where import refactors in Mako 1.0.11 caused broken 60 imports on Python 3.8. 61 62 63.. changelog:: 64 :version: 1.0.11 65 :released: Fri May 31 2019 66 67 .. change:: 68 :tags: change 69 70 Updated for additional project metadata in setup.py. Additionally, 71 the code has been reformatted using Black and zimports. 72 73.. changelog:: 74 :version: 1.0.10 75 :released: Fri May 10 2019 76 77 .. change:: 78 :tags: bug, py3k 79 :tickets: 293 80 81 Added a default encoding of "utf-8" when the :class:`.RichTraceback` 82 object retrieves Python source lines from a Python traceback; as these 83 are bytes in Python 3 they need to be decoded so that they can be 84 formatted in the template. 85 86.. changelog:: 87 :version: 1.0.9 88 :released: Mon Apr 15 2019 89 90 .. change:: 91 :tags: bug 92 :tickets: 287 93 94 Further corrected the previous fix for :ticket:`287` as it relied upon 95 an attribute that is monkeypatched by Python's ``ast`` module for some 96 reason, which fails if ``ast`` hasn't been imported; the correct 97 attribute ``Constant.value`` is now used. Also note the issue 98 was mis-numbered in the previous changelog note. 99 100.. changelog:: 101 :version: 1.0.8 102 :released: Wed Mar 20 2019 103 :released: Wed Mar 20 2019 104 105 .. change:: 106 :tags: bug 107 :tickets: 287 108 109 Fixed an element in the AST Python generator which changed 110 for Python 3.8, causing expression generation to fail. 111 112 .. change:: 113 :tags: feature 114 :tickets: 271 115 116 Added ``--output-encoding`` flag to the mako-render script. 117 Pull request courtesy lacsaP. 118 119 .. change:: 120 :tags: bug 121 122 Removed unnecessary "usage" prefix from mako-render script. 123 Pull request courtesy Hugo. 124 125.. changelog:: 126 :version: 1.0.7 127 :released: Thu Jul 13 2017 128 129 .. change:: 130 :tags: bug 131 132 Changed the "print" in the mako-render command to 133 sys.stdout.write(), avoiding the extra newline at the end 134 of the template output. Pull request courtesy 135 Yves Chevallier. 136 137.. changelog:: 138 :version: 1.0.6 139 :released: Wed Nov 9 2016 140 141 .. change:: 142 :tags: feature 143 144 Added new parameter :paramref:`.Template.include_error_handler` . 145 This works like :paramref:`.Template.error_handler` but indicates the 146 handler should take place when this template is included within another 147 template via the ``<%include>`` tag. Pull request courtesy 148 Huayi Zhang. 149 150.. changelog:: 151 :version: 1.0.5 152 :released: Wed Nov 2 2016 153 154 .. change:: 155 :tags: bug 156 157 Updated the Sphinx documentation builder to work with recent 158 versions of Sphinx. 159 160.. changelog:: 161 :version: 1.0.4 162 :released: Thu Mar 10 2016 163 164 .. change:: 165 :tags: feature, test 166 167 The default test runner is now py.test. Running "python setup.py test" 168 will make use of py.test instead of nose. nose still works as a test 169 runner as well, however. 170 171 .. change:: 172 :tags: bug, lexer 173 :pullreq: github:19 174 175 Major improvements to lexing of intricate Python sections which may 176 contain complex backslash sequences, as well as support for the bitwise 177 operator (e.g. pipe symbol) inside of expression sections distinct 178 from the Mako "filter" operator, provided the operator is enclosed 179 within parentheses or brackets. Pull request courtesy Daniel Martin. 180 181 .. change:: 182 :tags: feature 183 184 Added new method :meth:`.Template.list_defs`. Pull request courtesy 185 Jonathan Vanasco. 186 187.. changelog:: 188 :version: 1.0.3 189 :released: Tue Oct 27 2015 190 191 .. change:: 192 :tags: bug, babel 193 194 Fixed an issue where the Babel plugin would not handle a translation 195 symbol that contained non-ascii characters. Pull request courtesy 196 Roman Imankulov. 197 198.. changelog:: 199 :version: 1.0.2 200 :released: Wed Aug 26 2015 201 202 .. change:: 203 :tags: bug, installation 204 :tickets: 249 205 206 The "universal wheel" marker is removed from setup.cfg, because 207 our setup.py currently makes use of conditional dependencies. 208 In :ticket:`249`, the discussion is ongoing on how to correct our 209 setup.cfg / setup.py fully so that we can handle the per-version 210 dependency changes while still maintaining optimal wheel settings, 211 so this issue is not yet fully resolved. 212 213 .. change:: 214 :tags: bug, py3k 215 :tickets: 250 216 217 Repair some calls within the ast module that no longer work on Python3.5; 218 additionally replace the use of ``inspect.getargspec()`` under 219 Python 3 (seems to be called from the TG plugin) to avoid deprecation 220 warnings. 221 222 .. change:: 223 :tags: bug 224 225 Update the Lingua translation extraction plugin to correctly 226 handle templates mixing Python control statements (such as if, 227 for and while) with template fragments. Pull request courtesy 228 Laurent Daverio. 229 230 .. change:: 231 :tags: feature 232 :tickets: 236 233 234 Added ``STOP_RENDERING`` keyword for returning/exiting from a 235 template early, which is a synonym for an empty string ``""``. 236 Previously, the docs suggested a bare 237 ``return``, but this could cause ``None`` to appear in the 238 rendered template result. 239 240 .. seealso:: 241 242 :ref:`syntax_exiting_early` 243 244.. changelog:: 245 :version: 1.0.1 246 :released: Thu Jan 22 2015 247 248 .. change:: 249 :tags: feature 250 251 Added support for Lingua, a translation extraction system as an 252 alternative to Babel. Pull request courtesy Wichert Akkerman. 253 254 .. change:: 255 :tags: bug, py3k 256 257 Modernized the examples/wsgi/run_wsgi.py file for Py3k. 258 Pull requset courtesy Cody Taylor. 259 260.. changelog:: 261 :version: 1.0.0 262 :released: Sun Jun 8 2014 263 264 .. change:: 265 :tags: bug, py2k 266 267 Improved the error re-raise operation when a custom 268 :paramref:`.Template.error_handler` is used that does not handle 269 the exception; the original stack trace etc. is now preserved. 270 Pull request courtesy Manfred Haltner. 271 272 .. change:: 273 :tags: bug, py2k, filters 274 275 Added an html_escape filter that works in "non unicode" mode. 276 Previously, when using ``disable_unicode=True``, the ``u`` filter 277 would fail to handle non-ASCII bytes properly. Pull request 278 courtesy George Xie. 279 280 .. change:: 281 :tags: general 282 283 Compatibility changes; in order to modernize the codebase, Mako 284 is now dropping support for Python 2.4 and Python 2.5 altogether. 285 The source base is now targeted at Python 2.6 and forwards. 286 287 .. change:: 288 :tags: feature 289 290 Template modules now generate a JSON "metadata" structure at the bottom 291 of the source file which includes parseable information about the 292 templates' source file, encoding etc. as well as a mapping of module 293 source lines to template lines, thus replacing the "# SOURCE LINE" 294 markers throughout the source code. The structure also indicates those 295 lines that are explicitly not part of the template's source; the goal 296 here is to allow better integration with coverage and other tools. 297 298 .. change:: 299 :tags: bug, py3k 300 301 Fixed bug in ``decode.<encoding>`` filter where a non-string object 302 would not be correctly interpreted in Python 3. 303 304 .. change:: 305 :tags: bug, py3k 306 :tickets: 227 307 308 Fixed bug in Python parsing logic which would fail on Python 3 309 when a "try/except" targeted a tuple of exception types, rather 310 than a single exception. 311 312 .. change:: 313 :tags: feature 314 315 mako-render is now implemented as a setuptools entrypoint script; 316 a standalone mako.cmd.cmdline() callable is now available, and the 317 system also uses argparse now instead of optparse. Pull request 318 courtesy Derek Harland. 319 320 .. change:: 321 :tags: feature 322 323 The mako-render script will now catch exceptions and run them 324 into the text error handler, and exit with a non-zero exit code. 325 Pull request courtesy Derek Harland. 326 327 .. change:: 328 :tags: bug 329 330 A rework of the mako-render script allows the script to run 331 correctly when given a file pathname that is outside of the current 332 directory, e.g. ``mako-render ../some_template.mako``. In this case, 333 the "template root" defaults to the directory in which the template 334 is located, instead of ".". The script also accepts a new argument 335 ``--template-dir`` which can be specified multiple times to establish 336 template lookup directories. Standard input for templates also works 337 now too. Pull request courtesy Derek Harland. 338 339 .. change:: 340 :tags: feature, py3k 341 :pullreq: github:7 342 343 Support is added for Python 3 "keyword only" arguments, as used in 344 defs. Pull request courtesy Eevee. 345 346 3470.9 348=== 349 350.. changelog:: 351 :version: 0.9.1 352 :released: Thu Dec 26 2013 353 354 .. change:: 355 :tags: bug 356 :tickets: 225 357 358 Fixed bug in Babel plugin where translator comments 359 would be lost if intervening text nodes were encountered. 360 Fix courtesy Ned Batchelder. 361 362 .. change:: 363 :tags: bug 364 :tickets: 365 366 Fixed TGPlugin.render method to support unicode template 367 names in Py2K - courtesy Vladimir Magamedov. 368 369 .. change:: 370 :tags: bug 371 :tickets: 372 373 Fixed an AST issue that was preventing correct operation 374 under alpha versions of Python 3.4. Pullreq courtesy Zer0-. 375 376 .. change:: 377 :tags: bug 378 :tickets: 379 380 Changed the format of the "source encoding" header output 381 by the code generator to use the format ``# -*- coding:%s -*-`` 382 instead of ``# -*- encoding:%s -*-``; the former is more common 383 and compatible with emacs. Courtesy Martin Geisler. 384 385 .. change:: 386 :tags: bug 387 :tickets: 224 388 389 Fixed issue where an old lexer rule prevented a template line 390 which looked like "#*" from being correctly parsed. 391 392.. changelog:: 393 :version: 0.9.0 394 :released: Tue Aug 27 2013 395 396 .. change:: 397 :tags: bug 398 :tickets: 219 399 400 The Context.locals_() method becomes a private underscored 401 method, as this method has a specific internal use. The purpose 402 of Context.kwargs has been clarified, in that it only delivers 403 top level keyword arguments originally passed to template.render(). 404 405 .. change:: 406 :tags: bug 407 :tickets: 408 409 Fixed the babel plugin to properly interpret ${} sections 410 inside of a "call" tag, i.e. <%self:some_tag attr="${_('foo')}"/>. 411 Code that's subject to babel escapes in here needs to be 412 specified as a Python expression, not a literal. This change 413 is backwards incompatible vs. code that is relying upon a _('') 414 translation to be working within a call tag. 415 416 .. change:: 417 :tags: bug 418 :tickets: 187 419 420 The Babel plugin has been repaired to work on Python 3. 421 422 .. change:: 423 :tags: bug 424 :tickets: 207 425 426 Using <%namespace import="*" module="somemodule"/> now 427 skips over module elements that are not explcitly callable, 428 avoiding TypeError when trying to produce partials. 429 430 .. change:: 431 :tags: bug 432 :tickets: 190 433 434 Fixed Py3K bug where a "lambda" expression was not 435 interpreted correctly within a template tag; also 436 fixed in Py2.4. 437 4380.8 439=== 440 441.. changelog:: 442 :version: 0.8.1 443 :released: Fri May 24 2013 444 445 .. change:: 446 :tags: bug 447 :tickets: 216 448 449 Changed setup.py to skip installing markupsafe 450 if Python version is < 2.6 or is between 3.0 and 451 less than 3.3, as Markupsafe now only supports 2.6->2.X, 452 3.3->3.X. 453 454 .. change:: 455 :tags: bug 456 :tickets: 214 457 458 Fixed regression where "entity" filter wasn't 459 converted for py3k properly (added tests.) 460 461 .. change:: 462 :tags: bug 463 :tickets: 212 464 465 Fixed bug where mako-render script wasn't 466 compatible with Py3k. 467 468 .. change:: 469 :tags: bug 470 :tickets: 213 471 472 Cleaned up all the various deprecation/ 473 file warnings when running the tests under 474 various Pythons with warnings turned on. 475 476.. changelog:: 477 :version: 0.8.0 478 :released: Wed Apr 10 2013 479 480 .. change:: 481 :tags: feature 482 :tickets: 483 484 Performance improvement to the 485 "legacy" HTML escape feature, used for XML 486 escaping and when markupsafe isn't present, 487 courtesy George Xie. 488 489 .. change:: 490 :tags: bug 491 :tickets: 209 492 493 Fixed bug whereby an exception in Python 3 494 against a module compiled to the filesystem would 495 fail trying to produce a RichTraceback due to the 496 content being in bytes. 497 498 .. change:: 499 :tags: bug 500 :tickets: 208 501 502 Change default for compile()->reserved_names 503 from tuple to frozenset, as this is expected to be 504 a set by default. 505 506 .. change:: 507 :tags: feature 508 :tickets: 509 510 Code has been reworked to support Python 2.4-> 511 Python 3.xx in place. 2to3 no longer needed. 512 513 .. change:: 514 :tags: feature 515 :tickets: 516 517 Added lexer_cls argument to Template, 518 TemplateLookup, allows alternate Lexer classes 519 to be used. 520 521 .. change:: 522 :tags: feature 523 :tickets: 524 525 Added future_imports parameter to Template 526 and TemplateLookup, renders the __future__ header 527 with desired capabilities at the top of the generated 528 template module. Courtesy Ben Trofatter. 529 5300.7 531=== 532 533.. changelog:: 534 :version: 0.7.3 535 :released: Wed Nov 7 2012 536 537 .. change:: 538 :tags: bug 539 :tickets: 540 541 legacy_html_escape function, used when 542 Markupsafe isn't installed, was using an inline-compiled 543 regexp which causes major slowdowns on Python 3.3; 544 is now precompiled. 545 546 .. change:: 547 :tags: bug 548 :tickets: 201 549 550 AST supporting now supports tuple-packed 551 function arguments inside pure-python def 552 or lambda expressions. 553 554 .. change:: 555 :tags: bug 556 :tickets: 557 558 Fixed Py3K bug in the Babel extension. 559 560 .. change:: 561 :tags: bug 562 :tickets: 563 564 Fixed the "filter" attribute of the 565 <%text> tag so that it pulls locally specified 566 identifiers from the context the same 567 way as that of <%block> and <%filter>. 568 569 .. change:: 570 :tags: bug 571 :tickets: 572 573 Fixed bug in plugin loader to correctly 574 raise exception when non-existent plugin 575 is specified. 576 577.. changelog:: 578 :version: 0.7.2 579 :released: Fri Jul 20 2012 580 581 .. change:: 582 :tags: bug 583 :tickets: 193 584 585 Fixed regression in 0.7.1 where AST 586 parsing for Py2.4 was broken. 587 588.. changelog:: 589 :version: 0.7.1 590 :released: Sun Jul 8 2012 591 592 .. change:: 593 :tags: feature 594 :tickets: 146 595 596 Control lines with no bodies will 597 now succeed, as "pass" is added for these 598 when no statements are otherwise present. 599 Courtesy Ben Trofatter 600 601 .. change:: 602 :tags: bug 603 :tickets: 192 604 605 Fixed some long-broken scoping behavior 606 involving variables declared in defs and such, 607 which only became apparent when 608 the strict_undefined flag was turned on. 609 610 .. change:: 611 :tags: bug 612 :tickets: 191 613 614 Can now use strict_undefined at the 615 same time args passed to def() are used 616 by other elements of the <%def> tag. 617 618.. changelog:: 619 :version: 0.7.0 620 :released: Fri Mar 30 2012 621 622 .. change:: 623 :tags: feature 624 :tickets: 125 625 626 Added new "loop" variable to templates, 627 is provided within a % for block to provide 628 info about the loop such as index, first/last, 629 odd/even, etc. A migration path is also provided 630 for legacy templates via the "enable_loop" argument 631 available on Template, TemplateLookup, and <%page>. 632 Thanks to Ben Trofatter for all 633 the work on this 634 635 .. change:: 636 :tags: feature 637 :tickets: 638 639 Added a real check for "reserved" 640 names, that is names which are never pulled 641 from the context and cannot be passed to 642 the template.render() method. Current names 643 are "context", "loop", "UNDEFINED". 644 645 .. change:: 646 :tags: feature 647 :tickets: 95 648 649 The html_error_template() will now 650 apply Pygments highlighting to the source 651 code displayed in the traceback, if Pygments 652 if available. Courtesy Ben Trofatter 653 654 .. change:: 655 :tags: feature 656 :tickets: 147 657 658 Added support for context managers, 659 i.e. "% with x as e:/ % endwith" support. 660 Courtesy Ben Trofatter 661 662 .. change:: 663 :tags: feature 664 :tickets: 185 665 666 Added class-level flag to CacheImpl 667 "pass_context"; when True, the keyword argument 668 'context' will be passed to get_or_create() 669 containing the Mako Context object. 670 671 .. change:: 672 :tags: bug 673 :tickets: 182 674 675 Fixed some Py3K resource warnings due 676 to filehandles being implicitly closed. 677 678 .. change:: 679 :tags: bug 680 :tickets: 186 681 682 Fixed endless recursion bug when 683 nesting multiple def-calls with content. 684 Thanks to Jeff Dairiki. 685 686 .. change:: 687 :tags: feature 688 :tickets: 689 690 Added Jinja2 to the example 691 benchmark suite, courtesy Vincent Férotin 692 693Older Versions 694============== 695 696.. changelog:: 697 :version: 0.6.2 698 :released: Thu Feb 2 2012 699 700 .. change:: 701 :tags: bug 702 :tickets: 86, 20 703 704 The ${{"foo":"bar"}} parsing issue is fixed!! 705 The legendary Eevee has slain the dragon!. Also fixes quoting issue 706 at. 707 708.. changelog:: 709 :version: 0.6.1 710 :released: Sat Jan 28 2012 711 712 .. change:: 713 :tags: bug 714 :tickets: 715 716 Added special compatibility for the 0.5.0 717 Cache() constructor, which was preventing file 718 version checks and not allowing Mako 0.6 to 719 recompile the module files. 720 721.. changelog:: 722 :version: 0.6.0 723 :released: Sat Jan 21 2012 724 725 .. change:: 726 :tags: feature 727 :tickets: 728 729 Template caching has been converted into a plugin 730 system, whereby the usage of Beaker is just the 731 default plugin. Template and TemplateLookup 732 now accept a string "cache_impl" parameter which 733 refers to the name of a cache plugin, defaulting 734 to the name 'beaker'. New plugins can be 735 registered as pkg_resources entrypoints under 736 the group "mako.cache", or registered directly 737 using mako.cache.register_plugin(). The 738 core plugin is the mako.cache.CacheImpl 739 class. 740 741 .. change:: 742 :tags: feature 743 :tickets: 744 745 Added support for Beaker cache regions 746 in templates. Usage of regions should be considered 747 as superseding the very obsolete idea of passing in 748 backend options, timeouts, etc. within templates. 749 750 .. change:: 751 :tags: feature 752 :tickets: 753 754 The 'put' method on Cache is now 755 'set'. 'put' is there for backwards compatibility. 756 757 .. change:: 758 :tags: feature 759 :tickets: 760 761 The <%def>, <%block> and <%page> tags now accept 762 any argument named "cache_*", and the key 763 minus the "cache_" prefix will be passed as keyword 764 arguments to the CacheImpl methods. 765 766 .. change:: 767 :tags: feature 768 :tickets: 769 770 Template and TemplateLookup now accept an argument 771 cache_args, which refers to a dictionary containing 772 cache parameters. The cache_dir, cache_url, cache_type, 773 cache_timeout arguments are deprecated (will probably 774 never be removed, however) and can be passed 775 now as cache_args={'url':<some url>, 'type':'memcached', 776 'timeout':50, 'dir':'/path/to/some/directory'} 777 778 .. change:: 779 :tags: feature/bug 780 :tickets: 180 781 782 Can now refer to context variables 783 within extra arguments to <%block>, <%def>, i.e. 784 <%block name="foo" cache_key="${somekey}">. 785 Filters can also be used in this way, i.e. 786 <%def name="foo()" filter="myfilter"> 787 then template.render(myfilter=some_callable) 788 789 .. change:: 790 :tags: feature 791 :tickets: 178 792 793 Added "--var name=value" option to the mako-render 794 script, allows passing of kw to the template from 795 the command line. 796 797 .. change:: 798 :tags: feature 799 :tickets: 181 800 801 Added module_writer argument to Template, 802 TemplateLookup, allows a callable to be passed which 803 takes over the writing of the template's module source 804 file, so that special environment-specific steps 805 can be taken. 806 807 .. change:: 808 :tags: bug 809 :tickets: 142 810 811 The exception message in the html_error_template 812 is now escaped with the HTML filter. 813 814 .. change:: 815 :tags: bug 816 :tickets: 173 817 818 Added "white-space:pre" style to html_error_template() 819 for code blocks so that indentation is preserved 820 821 .. change:: 822 :tags: bug 823 :tickets: 175 824 825 The "benchmark" example is now Python 3 compatible 826 (even though several of those old template libs aren't 827 available on Py3K, so YMMV) 828 829 830.. changelog:: 831 :version: 0.5.0 832 :released: Wed Sep 28 2011 833 834 .. change:: 835 :tags: 836 :tickets: 174 837 838 A Template is explicitly disallowed 839 from having a url that normalizes to relative outside 840 of the root. That is, if the Lookup is based 841 at /home/mytemplates, an include that would place 842 the ultimate template at 843 /home/mytemplates/../some_other_directory, 844 i.e. outside of /home/mytemplates, 845 is disallowed. This usage was never intended 846 despite the lack of an explicit check. 847 The main issue this causes 848 is that module files can be written outside 849 of the module root (or raise an error, if file perms aren't 850 set up), and can also lead to the same template being 851 cached in the lookup under multiple, relative roots. 852 TemplateLookup instead has always supported multiple 853 file roots for this purpose. 854 855 856.. changelog:: 857 :version: 0.4.2 858 :released: Fri Aug 5 2011 859 860 .. change:: 861 :tags: 862 :tickets: 170 863 864 Fixed bug regarding <%call>/def calls w/ content 865 whereby the identity of the "caller" callable 866 inside the <%def> would be corrupted by the 867 presence of another <%call> in the same block. 868 869 .. change:: 870 :tags: 871 :tickets: 169 872 873 Fixed the babel plugin to accommodate <%block> 874 875.. changelog:: 876 :version: 0.4.1 877 :released: Wed Apr 6 2011 878 879 .. change:: 880 :tags: 881 :tickets: 164 882 883 New tag: <%block>. A variant on <%def> that 884 evaluates its contents in-place. 885 Can be named or anonymous, 886 the named version is intended for inheritance 887 layouts where any given section can be 888 surrounded by the <%block> tag in order for 889 it to become overrideable by inheriting 890 templates, without the need to specify a 891 top-level <%def> plus explicit call. 892 Modified scoping and argument rules as well as a 893 more strictly enforced usage scheme make it ideal 894 for this purpose without at all replacing most 895 other things that defs are still good for. 896 Lots of new docs. 897 898 .. change:: 899 :tags: 900 :tickets: 165 901 902 a slight adjustment to the "highlight" logic 903 for generating template bound stacktraces. 904 Will stick to known template source lines 905 without any extra guessing. 906 907.. changelog:: 908 :version: 0.4.0 909 :released: Sun Mar 6 2011 910 911 .. change:: 912 :tags: 913 :tickets: 914 915 A 20% speedup for a basic two-page 916 inheritance setup rendering 917 a table of escaped data 918 (see http://techspot.zzzeek.org/2010/11/19/quick-mako-vs.-jinja-speed-test/). 919 A few configurational changes which 920 affect those in the I-don't-do-unicode 921 camp should be noted below. 922 923 .. change:: 924 :tags: 925 :tickets: 926 927 The FastEncodingBuffer is now used 928 by default instead of cStringIO or StringIO, 929 regardless of whether output_encoding 930 is set to None or not. FEB is faster than 931 both. Only StringIO allows bytestrings 932 of unknown encoding to pass right 933 through, however - while it is of course 934 not recommended to send bytestrings of unknown 935 encoding to the output stream, this 936 mode of usage can be re-enabled by 937 setting the flag bytestring_passthrough 938 to True. 939 940 .. change:: 941 :tags: 942 :tickets: 943 944 disable_unicode mode requires that 945 output_encoding be set to None - it also 946 forces the bytestring_passthrough flag 947 to True. 948 949 .. change:: 950 :tags: 951 :tickets: 156 952 953 the <%namespace> tag raises an error 954 if the 'template' and 'module' attributes 955 are specified at the same time in 956 one tag. A different class is used 957 for each case which allows a reduction in 958 runtime conditional logic and function 959 call overhead. 960 961 .. change:: 962 :tags: 963 :tickets: 159 964 965 the keys() in the Context, as well as 966 it's internal _data dictionary, now 967 include just what was specified to 968 render() as well as Mako builtins 969 'caller', 'capture'. The contents 970 of __builtin__ are no longer copied. 971 Thanks to Daniel Lopez for pointing 972 this out. 973 974 975.. changelog:: 976 :version: 0.3.6 977 :released: Sat Nov 13 2010 978 979 .. change:: 980 :tags: 981 :tickets: 126 982 983 Documentation is on Sphinx. 984 985 .. change:: 986 :tags: 987 :tickets: 154 988 989 Beaker is now part of "extras" in 990 setup.py instead of "install_requires". 991 This to produce a lighter weight install 992 for those who don't use the caching 993 as well as to conform to Pyramid 994 deployment practices. 995 996 .. change:: 997 :tags: 998 :tickets: 153 999 1000 The Beaker import (or attempt thereof) 1001 is delayed until actually needed; 1002 this to remove the performance penalty 1003 from startup, particularly for 1004 "single execution" environments 1005 such as shell scripts. 1006 1007 .. change:: 1008 :tags: 1009 :tickets: 155 1010 1011 Patch to lexer to not generate an empty 1012 '' write in the case of backslash-ended 1013 lines. 1014 1015 .. change:: 1016 :tags: 1017 :tickets: 148 1018 1019 Fixed missing **extra collection in 1020 setup.py which prevented setup.py 1021 from running 2to3 on install. 1022 1023 .. change:: 1024 :tags: 1025 :tickets: 1026 1027 New flag on Template, TemplateLookup - 1028 strict_undefined=True, will cause 1029 variables not found in the context to 1030 raise a NameError immediately, instead of 1031 defaulting to the UNDEFINED value. 1032 1033 .. change:: 1034 :tags: 1035 :tickets: 1036 1037 The range of Python identifiers that 1038 are considered "undefined", meaning they 1039 are pulled from the context, has been 1040 trimmed back to not include variables 1041 declared inside of expressions (i.e. from 1042 list comprehensions), as well as 1043 in the argument list of lambdas. This 1044 to better support the strict_undefined 1045 feature. The change should be 1046 fully backwards-compatible but involved 1047 a little bit of tinkering in the AST code, 1048 which hadn't really been touched for 1049 a couple of years, just FYI. 1050 1051.. changelog:: 1052 :version: 0.3.5 1053 :released: Sun Oct 24 2010 1054 1055 .. change:: 1056 :tags: 1057 :tickets: 141 1058 1059 The <%namespace> tag allows expressions 1060 for the `file` argument, i.e. with ${}. 1061 The `context` variable, if needed, 1062 must be referenced explicitly. 1063 1064 .. change:: 1065 :tags: 1066 :tickets: 1067 1068 ${} expressions embedded in tags, 1069 such as <%foo:bar x="${...}">, now 1070 allow multiline Python expressions. 1071 1072 .. change:: 1073 :tags: 1074 :tickets: 1075 1076 Fixed previously non-covered regular 1077 expression, such that using a ${} expression 1078 inside of a tag element that doesn't allow 1079 them raises a CompileException instead of 1080 silently failing. 1081 1082 .. change:: 1083 :tags: 1084 :tickets: 151 1085 1086 Added a try/except around "import markupsafe". 1087 This to support GAE which can't run markupsafe. No idea whatsoever if the 1088 install_requires in setup.py also breaks GAE, 1089 couldn't get an answer on this. 1090 1091.. changelog:: 1092 :version: 0.3.4 1093 :released: Tue Jun 22 2010 1094 1095 .. change:: 1096 :tags: 1097 :tickets: 1098 1099 Now using MarkupSafe for HTML escaping, 1100 i.e. in place of cgi.escape(). Faster 1101 C-based implementation and also escapes 1102 single quotes for additional security. 1103 Supports the __html__ attribute for 1104 the given expression as well. 1105 1106 When using "disable_unicode" mode, 1107 a pure Python HTML escaper function 1108 is used which also quotes single quotes. 1109 1110 Note that Pylons by default doesn't 1111 use Mako's filter - check your 1112 environment.py file. 1113 1114 .. change:: 1115 :tags: 1116 :tickets: 137 1117 1118 Fixed call to "unicode.strip" in 1119 exceptions.text_error_template which 1120 is not Py3k compatible. 1121 1122.. changelog:: 1123 :version: 0.3.3 1124 :released: Mon May 31 2010 1125 1126 .. change:: 1127 :tags: 1128 :tickets: 135 1129 1130 Added conditional to RichTraceback 1131 such that if no traceback is passed 1132 and sys.exc_info() has been reset, 1133 the formatter just returns blank 1134 for the "traceback" portion. 1135 1136 .. change:: 1137 :tags: 1138 :tickets: 131 1139 1140 Fixed sometimes incorrect usage of 1141 exc.__class__.__name__ 1142 in html/text error templates when using 1143 Python 2.4 1144 1145 .. change:: 1146 :tags: 1147 :tickets: 1148 1149 Fixed broken @property decorator on 1150 template.last_modified 1151 1152 .. change:: 1153 :tags: 1154 :tickets: 132 1155 1156 Fixed error formatting when a stacktrace 1157 line contains no line number, as in when 1158 inside an eval/exec-generated function. 1159 1160 .. change:: 1161 :tags: 1162 :tickets: 1163 1164 When a .py is being created, the tempfile 1165 where the source is stored temporarily is 1166 now made in the same directory as that of 1167 the .py file. This ensures that the two 1168 files share the same filesystem, thus 1169 avoiding cross-filesystem synchronization 1170 issues. Thanks to Charles Cazabon. 1171 1172.. changelog:: 1173 :version: 0.3.2 1174 :released: Thu Mar 11 2010 1175 1176 .. change:: 1177 :tags: 1178 :tickets: 116 1179 1180 Calling a def from the top, via 1181 template.get_def(...).render() now checks the 1182 argument signature the same way as it did in 1183 0.2.5, so that TypeError is not raised. 1184 reopen of 1185 1186.. changelog:: 1187 :version: 0.3.1 1188 :released: Sun Mar 7 2010 1189 1190 .. change:: 1191 :tags: 1192 :tickets: 129 1193 1194 Fixed incorrect dir name in setup.py 1195 1196.. changelog:: 1197 :version: 0.3.0 1198 :released: Fri Mar 5 2010 1199 1200 .. change:: 1201 :tags: 1202 :tickets: 123 1203 1204 Python 2.3 support is dropped. 1205 1206 .. change:: 1207 :tags: 1208 :tickets: 119 1209 1210 Python 3 support is added ! See README.py3k 1211 for installation and testing notes. 1212 1213 .. change:: 1214 :tags: 1215 :tickets: 127 1216 1217 Unit tests now run with nose. 1218 1219 .. change:: 1220 :tags: 1221 :tickets: 99 1222 1223 Source code escaping has been simplified. 1224 In particular, module source files are now 1225 generated with the Python "magic encoding 1226 comment", and source code is passed through 1227 mostly unescaped, except for that code which 1228 is regenerated from parsed Python source. 1229 This fixes usage of unicode in 1230 <%namespace:defname> tags. 1231 1232 .. change:: 1233 :tags: 1234 :tickets: 122 1235 1236 RichTraceback(), html_error_template().render(), 1237 text_error_template().render() now accept "error" 1238 and "traceback" as optional arguments, and 1239 these are now actually used. 1240 1241 .. change:: 1242 :tags: 1243 :tickets: 1244 1245 The exception output generated when 1246 format_exceptions=True will now be as a Python 1247 unicode if it occurred during render_unicode(), 1248 or an encoded string if during render(). 1249 1250 .. change:: 1251 :tags: 1252 :tickets: 112 1253 1254 A percent sign can be emitted as the first 1255 non-whitespace character on a line by escaping 1256 it as in "%%". 1257 1258 .. change:: 1259 :tags: 1260 :tickets: 94 1261 1262 Template accepts empty control structure, i.e. 1263 % if: %endif, etc. 1264 1265 .. change:: 1266 :tags: 1267 :tickets: 116 1268 1269 The <%page args> tag can now be used in a base 1270 inheriting template - the full set of render() 1271 arguments are passed down through the inherits 1272 chain. Undeclared arguments go into **pageargs 1273 as usual. 1274 1275 .. change:: 1276 :tags: 1277 :tickets: 109 1278 1279 defs declared within a <%namespace> section, an 1280 uncommon feature, have been improved. The defs 1281 no longer get doubly-rendered in the body() scope, 1282 and now allow local variable assignment without 1283 breakage. 1284 1285 .. change:: 1286 :tags: 1287 :tickets: 128 1288 1289 Windows paths are handled correctly if a Template 1290 is passed only an absolute filename (i.e. with c: 1291 drive etc.) and no URI - the URI is converted 1292 to a forward-slash path and module_directory 1293 is treated as a windows path. 1294 1295 .. change:: 1296 :tags: 1297 :tickets: 73 1298 1299 TemplateLookup raises TopLevelLookupException for 1300 a given path that is a directory, not a filename, 1301 instead of passing through to the template to 1302 generate IOError. 1303 1304 1305.. changelog:: 1306 :version: 0.2.6 1307 :released: 1308 1309 .. change:: 1310 :tags: 1311 :tickets: 1312 1313 Fix mako function decorators to preserve the 1314 original function's name in all cases. Patch 1315 from Scott Torborg. 1316 1317 .. change:: 1318 :tags: 1319 :tickets: 118 1320 1321 Support the <%namespacename:defname> syntax in 1322 the babel extractor. 1323 1324 .. change:: 1325 :tags: 1326 :tickets: 88 1327 1328 Further fixes to unicode handling of .py files with the 1329 html_error_template. 1330 1331.. changelog:: 1332 :version: 0.2.5 1333 :released: Mon Sep 7 2009 1334 1335 .. change:: 1336 :tags: 1337 :tickets: 1338 1339 Added a "decorator" kw argument to <%def>, 1340 allows custom decoration functions to wrap 1341 rendering callables. Mainly intended for 1342 custom caching algorithms, not sure what 1343 other uses there may be (but there may be). 1344 Examples are in the "filtering" docs. 1345 1346 .. change:: 1347 :tags: 1348 :tickets: 101 1349 1350 When Mako creates subdirectories in which 1351 to store templates, it uses the more 1352 permissive mode of 0775 instead of 0750, 1353 helping out with certain multi-process 1354 scenarios. Note that the mode is always 1355 subject to the restrictions of the existing 1356 umask. 1357 1358 .. change:: 1359 :tags: 1360 :tickets: 104 1361 1362 Fixed namespace.__getattr__() to raise 1363 AttributeError on attribute not found 1364 instead of RuntimeError. 1365 1366 .. change:: 1367 :tags: 1368 :tickets: 97 1369 1370 Added last_modified accessor to Template, 1371 returns the time.time() when the module 1372 was created. 1373 1374 .. change:: 1375 :tags: 1376 :tickets: 102 1377 1378 Fixed lexing support for whitespace 1379 around '=' sign in defs. 1380 1381 .. change:: 1382 :tags: 1383 :tickets: 108 1384 1385 Removed errant "lower()" in the lexer which 1386 was causing tags to compile with 1387 case-insensitive names, thus messing up 1388 custom <%call> names. 1389 1390 .. change:: 1391 :tags: 1392 :tickets: 110 1393 1394 added "mako.__version__" attribute to 1395 the base module. 1396 1397.. changelog:: 1398 :version: 0.2.4 1399 :released: Tue Dec 23 2008 1400 1401 .. change:: 1402 :tags: 1403 :tickets: 1404 1405 Fixed compatibility with Jython 2.5b1. 1406 1407.. changelog:: 1408 :version: 0.2.3 1409 :released: Sun Nov 23 2008 1410 1411 .. change:: 1412 :tags: 1413 :tickets: 1414 1415 the <%namespacename:defname> syntax described at 1416 http://techspot.zzzeek.org/?p=28 has now 1417 been added as a built in syntax, and is recommended 1418 as a more modern syntax versus <%call expr="expression">. 1419 The %call tag itself will always remain, 1420 with <%namespacename:defname> presenting a more HTML-like 1421 alternative to calling defs, both plain and 1422 nested. Many examples of the new syntax are in the 1423 "Calling a def with embedded content" section 1424 of the docs. 1425 1426 .. change:: 1427 :tags: 1428 :tickets: 1429 1430 added support for Jython 2.5. 1431 1432 .. change:: 1433 :tags: 1434 :tickets: 1435 1436 cache module now uses Beaker's CacheManager 1437 object directly, so that all cache types are included. 1438 memcached is available as both "ext:memcached" and 1439 "memcached", the latter for backwards compatibility. 1440 1441 .. change:: 1442 :tags: 1443 :tickets: 1444 1445 added "cache" accessor to Template, Namespace. 1446 e.g. ${local.cache.get('somekey')} or 1447 template.cache.invalidate_body() 1448 1449 .. change:: 1450 :tags: 1451 :tickets: 1452 1453 added "cache_enabled=True" flag to Template, 1454 TemplateLookup. Setting this to False causes cache 1455 operations to "pass through" and execute every time; 1456 this flag should be integrated in Pylons with its own 1457 cache_enabled configuration setting. 1458 1459 .. change:: 1460 :tags: 1461 :tickets: 92 1462 1463 the Cache object now supports invalidate_def(name), 1464 invalidate_body(), invalidate_closure(name), 1465 invalidate(key), which will remove the given key 1466 from the cache, if it exists. The cache arguments 1467 (i.e. storage type) are derived from whatever has 1468 been already persisted for that template. 1469 1470 .. change:: 1471 :tags: 1472 :tickets: 1473 1474 For cache changes to work fully, Beaker 1.1 is required. 1475 1.0.1 and up will work as well with the exception of 1476 cache expiry. Note that Beaker 1.1 is **required** 1477 for applications which use dynamically generated keys, 1478 since previous versions will permanently store state in memory 1479 for each individual key, thus consuming all available 1480 memory for an arbitrarily large number of distinct 1481 keys. 1482 1483 .. change:: 1484 :tags: 1485 :tickets: 93 1486 1487 fixed bug whereby an <%included> template with 1488 <%page> args named the same as a __builtin__ would not 1489 honor the default value specified in <%page> 1490 1491 .. change:: 1492 :tags: 1493 :tickets: 88 1494 1495 fixed the html_error_template not handling tracebacks from 1496 normal .py files with a magic encoding comment 1497 1498 .. change:: 1499 :tags: 1500 :tickets: 1501 1502 RichTraceback() now accepts an optional traceback object 1503 to be used in place of sys.exc_info()[2]. html_error_template() 1504 and text_error_template() accept an optional 1505 render()-time argument "traceback" which is passed to the 1506 RichTraceback object. 1507 1508 .. change:: 1509 :tags: 1510 :tickets: 1511 1512 added ModuleTemplate class, which allows the construction 1513 of a Template given a Python module generated by a previous 1514 Template. This allows Python modules alone to be used 1515 as templates with no compilation step. Source code 1516 and template source are optional but allow error reporting 1517 to work correctly. 1518 1519 .. change:: 1520 :tags: 1521 :tickets: 90 1522 1523 fixed Python 2.3 compat. in mako.pyparser 1524 1525 .. change:: 1526 :tags: 1527 :tickets: 1528 1529 fix Babel 0.9.3 compatibility; stripping comment tags is now 1530 optional (and enabled by default). 1531 1532.. changelog:: 1533 :version: 0.2.2 1534 :released: Mon Jun 23 2008 1535 1536 .. change:: 1537 :tags: 1538 :tickets: 87 1539 1540 cached blocks now use the current context when rendering 1541 an expired section, instead of the original context 1542 passed in 1543 1544 .. change:: 1545 :tags: 1546 :tickets: 1547 1548 fixed a critical issue regarding caching, whereby 1549 a cached block would raise an error when called within a 1550 cache-refresh operation that was initiated after the 1551 initiating template had completed rendering. 1552 1553.. changelog:: 1554 :version: 0.2.1 1555 :released: Mon Jun 16 2008 1556 1557 .. change:: 1558 :tags: 1559 :tickets: 1560 1561 fixed bug where 'output_encoding' parameter would prevent 1562 render_unicode() from returning a unicode object. 1563 1564 .. change:: 1565 :tags: 1566 :tickets: 1567 1568 bumped magic number, which forces template recompile for 1569 this version (fixes incompatible compile symbols from 0.1 1570 series). 1571 1572 .. change:: 1573 :tags: 1574 :tickets: 1575 1576 added a few docs for cache options, specifically those that 1577 help with memcached. 1578 1579.. changelog:: 1580 :version: 0.2.0 1581 :released: Tue Jun 3 2008 1582 1583 .. change:: 1584 :tags: 1585 :tickets: 1586 1587 Speed improvements (as though we needed them, but people 1588 contributed and there you go): 1589 1590 .. change:: 1591 :tags: 1592 :tickets: 77 1593 1594 added "bytestring passthru" mode, via 1595 `disable_unicode=True` argument passed to Template or 1596 TemplateLookup. All unicode-awareness and filtering is 1597 turned off, and template modules are generated with 1598 the appropriate magic encoding comment. In this mode, 1599 template expressions can only receive raw bytestrings 1600 or Unicode objects which represent straight ASCII, and 1601 render_unicode() may not be used if multibyte 1602 characters are present. When enabled, speed 1603 improvement around 10-20%. (courtesy 1604 anonymous guest) 1605 1606 .. change:: 1607 :tags: 1608 :tickets: 76 1609 1610 inlined the "write" function of Context into a local 1611 template variable. This affords a 12-30% speedup in 1612 template render time. (idea courtesy same anonymous 1613 guest) 1614 1615 .. change:: 1616 :tags: 1617 :tickets: 1618 1619 New Features, API changes: 1620 1621 .. change:: 1622 :tags: 1623 :tickets: 62 1624 1625 added "attr" accessor to namespaces. Returns 1626 attributes configured as module level attributes, i.e. 1627 within <%! %> sections. i.e.: 1628 1629 # somefile.html 1630 <%! 1631 foo = 27 1632 %> 1633 1634 # some other template 1635 <%namespace name="myns" file="somefile.html"/> 1636 ${myns.attr.foo} 1637 1638 The slight backwards incompatibility here is, you 1639 can't have namespace defs named "attr" since the 1640 "attr" descriptor will occlude it. 1641 1642 .. change:: 1643 :tags: 1644 :tickets: 78 1645 1646 cache_key argument can now render arguments passed 1647 directly to the %page or %def, i.e. <%def 1648 name="foo(x)" cached="True" cache_key="${x}"/> 1649 1650 .. change:: 1651 :tags: 1652 :tickets: 1653 1654 some functions on Context are now private: 1655 _push_buffer(), _pop_buffer(), 1656 caller_stack._push_frame(), caller_stack._pop_frame(). 1657 1658 .. change:: 1659 :tags: 1660 :tickets: 56, 81 1661 1662 added a runner script "mako-render" which renders 1663 standard input as a template to stdout 1664 1665 .. change:: 1666 :tags: bugfixes 1667 :tickets: 83, 84 1668 1669 can now use most names from __builtins__ as variable 1670 names without explicit declaration (i.e. 'id', 1671 'exception', 'range', etc.) 1672 1673 .. change:: 1674 :tags: bugfixes 1675 :tickets: 84 1676 1677 can also use builtin names as local variable names 1678 (i.e. dict, locals) (came from fix for) 1679 1680 .. change:: 1681 :tags: bugfixes 1682 :tickets: 68 1683 1684 fixed bug in python generation when variable names are 1685 used with identifiers like "else", "finally", etc. 1686 inside them 1687 1688 .. change:: 1689 :tags: bugfixes 1690 :tickets: 69 1691 1692 fixed codegen bug which occurred when using <%page> 1693 level caching, combined with an expression-based 1694 cache_key, combined with the usage of <%namespace 1695 import="*"/> - fixed lexer exceptions not cleaning up 1696 temporary files, which could lead to a maximum number 1697 of file descriptors used in the process 1698 1699 .. change:: 1700 :tags: bugfixes 1701 :tickets: 71 1702 1703 fixed issue with inline format_exceptions that was 1704 producing blank exception pages when an inheriting 1705 template is present 1706 1707 .. change:: 1708 :tags: bugfixes 1709 :tickets: 1710 1711 format_exceptions will apply the encoding options of 1712 html_error_template() to the buffered output 1713 1714 .. change:: 1715 :tags: bugfixes 1716 :tickets: 75 1717 1718 rewrote the "whitespace adjuster" function to work 1719 with more elaborate combinations of quotes and 1720 comments 1721 1722 1723.. changelog:: 1724 :version: 0.1.10 1725 :released: 1726 1727 .. change:: 1728 :tags: 1729 :tickets: 1730 1731 fixed propagation of 'caller' such that nested %def calls 1732 within a <%call> tag's argument list propigates 'caller' 1733 to the %call function itself (propigates to the inner 1734 calls too, this is a slight side effect which previously 1735 existed anyway) 1736 1737 .. change:: 1738 :tags: 1739 :tickets: 1740 1741 fixed bug where local.get_namespace() could put an 1742 incorrect "self" in the current context 1743 1744 .. change:: 1745 :tags: 1746 :tickets: 1747 1748 fixed another namespace bug where the namespace functions 1749 did not have access to the correct context containing 1750 their 'self' and 'parent' 1751 1752.. changelog:: 1753 :version: 0.1.9 1754 :released: 1755 1756 .. change:: 1757 :tags: 1758 :tickets: 47 1759 1760 filters.Decode filter can also accept a non-basestring 1761 object and will call str() + unicode() on it 1762 1763 .. change:: 1764 :tags: 1765 :tickets: 53 1766 1767 comments can be placed at the end of control lines, 1768 i.e. if foo: # a comment,, thanks to 1769 Paul Colomiets 1770 1771 .. change:: 1772 :tags: 1773 :tickets: 16 1774 1775 fixed expressions and page tag arguments and with embedded 1776 newlines in CRLF templates, follow up to, thanks 1777 Eric Woroshow 1778 1779 .. change:: 1780 :tags: 1781 :tickets: 51 1782 1783 added an IOError catch for source file not found in RichTraceback 1784 exception reporter 1785 1786.. changelog:: 1787 :version: 0.1.8 1788 :released: Tue Jun 26 2007 1789 1790 .. change:: 1791 :tags: 1792 :tickets: 1793 1794 variable names declared in render methods by internal 1795 codegen prefixed by "__M_" to prevent name collisions 1796 with user code 1797 1798 .. change:: 1799 :tags: 1800 :tickets: 45 1801 1802 added a Babel (http://babel.edgewall.org/) extractor entry 1803 point, allowing extraction of gettext messages directly from 1804 mako templates via Babel 1805 1806 .. change:: 1807 :tags: 1808 :tickets: 1809 1810 fix to turbogears plugin to work with dot-separated names 1811 (i.e. load_template('foo.bar')). also takes file extension 1812 as a keyword argument (default is 'mak'). 1813 1814 .. change:: 1815 :tags: 1816 :tickets: 35 1817 1818 more tg fix: fixed, allowing string-based 1819 templates with tgplugin even if non-compatible args were sent 1820 1821.. changelog:: 1822 :version: 0.1.7 1823 :released: Wed Jun 13 2007 1824 1825 .. change:: 1826 :tags: 1827 :tickets: 1828 1829 one small fix to the unit tests to support python 2.3 1830 1831 .. change:: 1832 :tags: 1833 :tickets: 1834 1835 a slight hack to how cache.py detects Beaker's memcached, 1836 works around unexplained import behavior observed on some 1837 python 2.3 installations 1838 1839.. changelog:: 1840 :version: 0.1.6 1841 :released: Fri May 18 2007 1842 1843 .. change:: 1844 :tags: 1845 :tickets: 1846 1847 caching is now supplied directly by Beaker, which has 1848 all of MyghtyUtils merged into it now. The latest Beaker 1849 (0.7.1) also fixes a bug related to how Mako was using the 1850 cache API. 1851 1852 .. change:: 1853 :tags: 1854 :tickets: 34 1855 1856 fix to module_directory path generation when the path is "./" 1857 1858 .. change:: 1859 :tags: 1860 :tickets: 35 1861 1862 TGPlugin passes options to string-based templates 1863 1864 .. change:: 1865 :tags: 1866 :tickets: 28 1867 1868 added an explicit stack frame step to template runtime, which 1869 allows much simpler and hopefully bug-free tracking of 'caller', 1870 fixes 1871 1872 .. change:: 1873 :tags: 1874 :tickets: 1875 1876 if plain Python defs are used with <%call>, a decorator 1877 @runtime.supports_callable exists to ensure that the "caller" 1878 stack is properly handled for the def. 1879 1880 .. change:: 1881 :tags: 1882 :tickets: 37 1883 1884 fix to RichTraceback and exception reporting to get template 1885 source code as a unicode object 1886 1887 .. change:: 1888 :tags: 1889 :tickets: 39 1890 1891 html_error_template includes options "full=True", "css=True" 1892 which control generation of HTML tags, CSS 1893 1894 .. change:: 1895 :tags: 1896 :tickets: 40 1897 1898 added the 'encoding_errors' parameter to Template/TemplateLookup 1899 for specifying the error handler associated with encoding to 1900 'output_encoding' 1901 1902 .. change:: 1903 :tags: 1904 :tickets: 37 1905 1906 the Template returned by html_error_template now defaults to 1907 output_encoding=sys.getdefaultencoding(), 1908 encoding_errors='htmlentityreplace' 1909 1910 .. change:: 1911 :tags: 1912 :tickets: 1913 1914 control lines, i.e. % lines, support backslashes to continue long 1915 lines (#32) 1916 1917 .. change:: 1918 :tags: 1919 :tickets: 1920 1921 fixed codegen bug when defining <%def> within <%call> within <%call> 1922 1923 .. change:: 1924 :tags: 1925 :tickets: 1926 1927 leading utf-8 BOM in template files is honored according to pep-0263 1928 1929.. changelog:: 1930 :version: 0.1.5 1931 :released: Sat Mar 31 2007 1932 1933 .. change:: 1934 :tags: 1935 :tickets: 26 1936 1937 AST expression generation - added in just about everything 1938 expression-wise from the AST module 1939 1940 .. change:: 1941 :tags: 1942 :tickets: 27 1943 1944 AST parsing, properly detects imports of the form "import foo.bar" 1945 1946 .. change:: 1947 :tags: 1948 :tickets: 1949 1950 fix to lexing of <%docs> tag nested in other tags 1951 1952 .. change:: 1953 :tags: 1954 :tickets: 29 1955 1956 fix to context-arguments inside of <%include> tag which broke 1957 during 0.1.4 1958 1959 .. change:: 1960 :tags: 1961 :tickets: 1962 1963 added "n" filter, disables *all* filters normally applied to an expression 1964 via <%page> or default_filters (but not those within the filter) 1965 1966 .. change:: 1967 :tags: 1968 :tickets: 1969 1970 added buffer_filters argument, defines filters applied to the return value 1971 of buffered/cached/filtered %defs, after all filters defined with the %def 1972 itself have been applied. allows the creation of default expression filters 1973 that let the output of return-valued %defs "opt out" of that filtering 1974 via passing special attributes or objects. 1975 1976.. changelog:: 1977 :version: 0.1.4 1978 :released: Sat Mar 10 2007 1979 1980 .. change:: 1981 :tags: 1982 :tickets: 1983 1984 got defs-within-defs to be cacheable 1985 1986 .. change:: 1987 :tags: 1988 :tickets: 23 1989 1990 fixes to code parsing/whitespace adjusting where plain python comments 1991 may contain quote characters 1992 1993 .. change:: 1994 :tags: 1995 :tickets: 1996 1997 fix to variable scoping for identifiers only referenced within 1998 functions 1999 2000 .. change:: 2001 :tags: 2002 :tickets: 2003 2004 added a path normalization step to lookup so URIs like 2005 "/foo/bar/../etc/../foo" pre-process the ".." tokens before checking 2006 the filesystem 2007 2008 .. change:: 2009 :tags: 2010 :tickets: 2011 2012 fixed/improved "caller" semantics so that undefined caller is 2013 "UNDEFINED", propigates __nonzero__ method so it evaulates to False if 2014 not present, True otherwise. this way you can say % if caller:\n 2015 ${caller.body()}\n% endif 2016 2017 .. change:: 2018 :tags: 2019 :tickets: 2020 2021 <%include> has an "args" attribute that can pass arguments to the 2022 called template (keyword arguments only, must be declared in that 2023 page's <%page> tag.) 2024 2025 .. change:: 2026 :tags: 2027 :tickets: 2028 2029 <%include> plus arguments is also programmatically available via 2030 self.include_file(<filename>, **kwargs) 2031 2032 .. change:: 2033 :tags: 2034 :tickets: 24 2035 2036 further escaping added for multibyte expressions in %def, %call 2037 attributes 2038 2039.. changelog:: 2040 :version: 0.1.3 2041 :released: Wed Feb 21 2007 2042 2043 .. change:: 2044 :tags: 2045 :tickets: 2046 2047 ***Small Syntax Change*** - the single line comment character is now 2048 *two* hash signs, i.e. "## this is a comment". This avoids a common 2049 collection with CSS selectors. 2050 2051 .. change:: 2052 :tags: 2053 :tickets: 2054 2055 the magic "coding" comment (i.e. # coding:utf-8) will still work with 2056 either one "#" sign or two for now; two is preferred going forward, i.e. 2057 ## coding:<someencoding>. 2058 2059 .. change:: 2060 :tags: 2061 :tickets: 2062 2063 new multiline comment form: "<%doc> a comment </%doc>" 2064 2065 .. change:: 2066 :tags: 2067 :tickets: 2068 2069 UNDEFINED evaluates to False 2070 2071 .. change:: 2072 :tags: 2073 :tickets: 2074 2075 improvement to scoping of "caller" variable when using <%call> tag 2076 2077 .. change:: 2078 :tags: 2079 :tickets: 2080 2081 added lexer error for unclosed control-line (%) line 2082 2083 .. change:: 2084 :tags: 2085 :tickets: 2086 2087 added "preprocessor" argument to Template, TemplateLookup - is a single 2088 callable or list of callables which will be applied to the template text 2089 before lexing. given the text as an argument, returns the new text. 2090 2091 .. change:: 2092 :tags: 2093 :tickets: 2094 2095 added mako.ext.preprocessors package, contains one preprocessor so far: 2096 'convert_comments', which will convert single # comments to the new ## 2097 format 2098 2099.. changelog:: 2100 :version: 0.1.2 2101 :released: Thu Feb 1 2007 2102 2103 .. change:: 2104 :tags: 2105 :tickets: 11 2106 2107 fix to parsing of code/expression blocks to insure that non-ascii 2108 characters, combined with a template that indicates a non-standard 2109 encoding, are expanded into backslash-escaped glyphs before being AST 2110 parsed 2111 2112 .. change:: 2113 :tags: 2114 :tickets: 2115 2116 all template lexing converts the template to unicode first, to 2117 immediately catch any encoding issues and ensure internal unicode 2118 representation. 2119 2120 .. change:: 2121 :tags: 2122 :tickets: 2123 2124 added module_filename argument to Template to allow specification of a 2125 specific module file 2126 2127 .. change:: 2128 :tags: 2129 :tickets: 14 2130 2131 added modulename_callable to TemplateLookup to allow a function to 2132 determine module filenames (takes filename, uri arguments). used for 2133 2134 .. change:: 2135 :tags: 2136 :tickets: 2137 2138 added optional input_encoding flag to Template, to allow sending a 2139 unicode() object with no magic encoding comment 2140 2141 .. change:: 2142 :tags: 2143 :tickets: 2144 2145 "expression_filter" argument in <%page> applies only to expressions 2146 2147 .. change:: 2148 :tags: "unicode" 2149 :tickets: 2150 2151 added "default_filters" argument to Template, TemplateLookup. applies only 2152 to expressions, gets prepended to "expression_filter" arg from <%page>. 2153 defaults to, so that all expressions get stringified into u'' 2154 by default (this is what Mako already does). By setting to [], expressions 2155 are passed through raw. 2156 2157 .. change:: 2158 :tags: 2159 :tickets: 2160 2161 added "imports" argument to Template, TemplateLookup. so you can predefine 2162 a list of import statements at the top of the template. can be used in 2163 conjunction with default_filters. 2164 2165 .. change:: 2166 :tags: 2167 :tickets: 16 2168 2169 support for CRLF templates...whoops ! welcome to all the windows users. 2170 2171 .. change:: 2172 :tags: 2173 :tickets: 2174 2175 small fix to local variable propigation for locals that are conditionally 2176 declared 2177 2178 .. change:: 2179 :tags: 2180 :tickets: 2181 2182 got "top level" def calls to work, i.e. template.get_def("somedef").render() 2183 2184.. changelog:: 2185 :version: 0.1.1 2186 :released: Sun Jan 14 2007 2187 2188 .. change:: 2189 :tags: 2190 :tickets: 8 2191 2192 buffet plugin supports string-based templates, allows ToscaWidgets to work 2193 2194 .. change:: 2195 :tags: 2196 :tickets: 2197 2198 AST parsing fixes: fixed TryExcept identifier parsing 2199 2200 .. change:: 2201 :tags: 2202 :tickets: 2203 2204 removed textmate tmbundle from contrib and into separate SVN location; 2205 windows users cant handle those files, setuptools not very good at 2206 "pruning" certain directories 2207 2208 .. change:: 2209 :tags: 2210 :tickets: 2211 2212 fix so that "cache_timeout" parameter is propigated 2213 2214 .. change:: 2215 :tags: 2216 :tickets: 2217 2218 fix to expression filters so that string conversion (actually unicode) 2219 properly occurs before filtering 2220 2221 .. change:: 2222 :tags: 2223 :tickets: 2224 2225 better error message when a lookup is attempted with a template that has no 2226 lookup 2227 2228 .. change:: 2229 :tags: 2230 :tickets: 2231 2232 implemented "module" attribute for namespace 2233 2234 .. change:: 2235 :tags: 2236 :tickets: 2237 2238 fix to code generation to correctly track multiple defs with the same name 2239 2240 .. change:: 2241 :tags: 2242 :tickets: 9 2243 2244 "directories" can be passed to TemplateLookup as a scalar in which case it 2245 gets converted to a list 2246