CHANGES 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. 0.8.1
  2. - [bug] Changed setup.py to skip installing markupsafe
  3. if Python version is < 2.6 or is between 3.0 and
  4. less than 3.3, as Markupsafe now only supports 2.6->2.X,
  5. 3.3->3.X. [ticket:216]
  6. - [bug] Fixed regression where "entity" filter wasn't
  7. converted for py3k properly (added tests.)
  8. [ticket:214]
  9. - [bug] Fixed bug where mako-render script wasn't
  10. compatible with Py3k. [ticket:212]
  11. - [bug] Cleaned up all the various deprecation/
  12. file warnings when running the tests under
  13. various Pythons with warnings turned on.
  14. [ticket:213]
  15. 0.8.0
  16. - [feature] Performance improvement to the
  17. "legacy" HTML escape feature, used for XML
  18. escaping and when markupsafe isn't present,
  19. courtesy George Xie.
  20. - [bug] Fixed bug whereby an exception in Python 3
  21. against a module compiled to the filesystem would
  22. fail trying to produce a RichTraceback due to the
  23. content being in bytes. [ticket:209]
  24. - [bug] Change default for compile()->reserved_names
  25. from tuple to frozenset, as this is expected to be
  26. a set by default. [ticket:208]
  27. - [feature] Code has been reworked to support Python 2.4->
  28. Python 3.xx in place. 2to3 no longer needed.
  29. - [feature] Added lexer_cls argument to Template,
  30. TemplateLookup, allows alternate Lexer classes
  31. to be used.
  32. - [feature] Added future_imports parameter to Template
  33. and TemplateLookup, renders the __future__ header
  34. with desired capabilities at the top of the generated
  35. template module. Courtesy Ben Trofatter.
  36. 0.7.3
  37. - [bug] legacy_html_escape function, used when
  38. Markupsafe isn't installed, was using an inline-compiled
  39. regexp which causes major slowdowns on Python 3.3;
  40. is now precompiled.
  41. - [bug] AST supporting now supports tuple-packed
  42. function arguments inside pure-python def
  43. or lambda expressions. [ticket:201]
  44. - [bug] Fixed Py3K bug in the Babel extension.
  45. - [bug] Fixed the "filter" attribute of the
  46. <%text> tag so that it pulls locally specified
  47. identifiers from the context the same
  48. way as that of <%block> and <%filter>.
  49. - [bug] Fixed bug in plugin loader to correctly
  50. raise exception when non-existent plugin
  51. is specified.
  52. 0.7.2
  53. - [bug] Fixed regression in 0.7.1 where AST
  54. parsing for Py2.4 was broken.
  55. [ticket:193]
  56. 0.7.1
  57. - [feature] Control lines with no bodies will
  58. now succeed, as "pass" is added for these
  59. when no statements are otherwise present.
  60. Courtesy Ben Trofatter [ticket:146]
  61. - [bug] Fixed some long-broken scoping behavior
  62. involving variables declared in defs and such,
  63. which only became apparent when
  64. the strict_undefined flag was turned on.
  65. [ticket:192]
  66. - [bug] Can now use strict_undefined at the
  67. same time args passed to def() are used
  68. by other elements of the <%def> tag.
  69. [ticket:191]
  70. 0.7.0
  71. - [feature] Added new "loop" variable to templates,
  72. is provided within a % for block to provide
  73. info about the loop such as index, first/last,
  74. odd/even, etc. A migration path is also provided
  75. for legacy templates via the "enable_loop" argument
  76. available on Template, TemplateLookup, and <%page>.
  77. Thanks to Ben Trofatter for all
  78. the work on this [ticket:125]
  79. - [feature] Added a real check for "reserved"
  80. names, that is names which are never pulled
  81. from the context and cannot be passed to
  82. the template.render() method. Current names
  83. are "context", "loop", "UNDEFINED".
  84. - [feature] The html_error_template() will now
  85. apply Pygments highlighting to the source
  86. code displayed in the traceback, if Pygments
  87. if available. Courtesy Ben Trofatter
  88. [ticket:95]
  89. - [feature] Added support for context managers,
  90. i.e. "% with x as e:/ % endwith" support.
  91. Courtesy Ben Trofatter [ticket:147]
  92. - [feature] Added class-level flag to CacheImpl
  93. "pass_context"; when True, the keyword argument
  94. 'context' will be passed to get_or_create()
  95. containing the Mako Context object.
  96. [ticket:185]
  97. - [bug] Fixed some Py3K resource warnings due
  98. to filehandles being implicitly closed.
  99. [ticket:182]
  100. - [bug] Fixed endless recursion bug when
  101. nesting multiple def-calls with content.
  102. Thanks to Jeff Dairiki. [ticket:186]
  103. - [feature] Added Jinja2 to the example
  104. benchmark suite, courtesy Vincent Férotin
  105. 0.6.2
  106. - [bug] The ${{"foo":"bar"}} parsing issue is fixed!!
  107. The legendary Eevee has slain the dragon!
  108. [ticket:20]. Also fixes quoting issue
  109. at [ticket:86].
  110. 0.6.1
  111. - [bug] Added special compatibility for the 0.5.0
  112. Cache() constructor, which was preventing file
  113. version checks and not allowing Mako 0.6 to
  114. recompile the module files.
  115. 0.6.0
  116. - [feature] Template caching has been converted into a plugin
  117. system, whereby the usage of Beaker is just the
  118. default plugin. Template and TemplateLookup
  119. now accept a string "cache_impl" parameter which
  120. refers to the name of a cache plugin, defaulting
  121. to the name 'beaker'. New plugins can be
  122. registered as pkg_resources entrypoints under
  123. the group "mako.cache", or registered directly
  124. using mako.cache.register_plugin(). The
  125. core plugin is the mako.cache.CacheImpl
  126. class.
  127. - [feature] Added support for Beaker cache regions
  128. in templates. Usage of regions should be considered
  129. as superseding the very obsolete idea of passing in
  130. backend options, timeouts, etc. within templates.
  131. - [feature] The 'put' method on Cache is now
  132. 'set'. 'put' is there for backwards compatibility.
  133. - [feature] The <%def>, <%block> and <%page> tags now accept
  134. any argument named "cache_*", and the key
  135. minus the "cache_" prefix will be passed as keyword
  136. arguments to the CacheImpl methods.
  137. - [feature] Template and TemplateLookup now accept an argument
  138. cache_args, which refers to a dictionary containing
  139. cache parameters. The cache_dir, cache_url, cache_type,
  140. cache_timeout arguments are deprecated (will probably
  141. never be removed, however) and can be passed
  142. now as cache_args={'url':<some url>, 'type':'memcached',
  143. 'timeout':50, 'dir':'/path/to/some/directory'}
  144. - [feature/bug] Can now refer to context variables
  145. within extra arguments to <%block>, <%def>, i.e.
  146. <%block name="foo" cache_key="${somekey}">.
  147. Filters can also be used in this way, i.e.
  148. <%def name="foo()" filter="myfilter">
  149. then template.render(myfilter=some_callable)
  150. [ticket:180]
  151. - [feature] Added "--var name=value" option to the mako-render
  152. script, allows passing of kw to the template from
  153. the command line. [ticket:178]
  154. - [feature] Added module_writer argument to Template,
  155. TemplateLookup, allows a callable to be passed which
  156. takes over the writing of the template's module source
  157. file, so that special environment-specific steps
  158. can be taken. [ticket:181]
  159. - [bug] The exception message in the html_error_template
  160. is now escaped with the HTML filter. [ticket:142]
  161. - [bug] Added "white-space:pre" style to html_error_template()
  162. for code blocks so that indentation is preserved
  163. [ticket:173]
  164. - [bug] The "benchmark" example is now Python 3 compatible
  165. (even though several of those old template libs aren't
  166. available on Py3K, so YMMV) [ticket:175]
  167. 0.5
  168. - A Template is explicitly disallowed
  169. from having a url that normalizes to relative outside
  170. of the root. That is, if the Lookup is based
  171. at /home/mytemplates, an include that would place
  172. the ultimate template at
  173. /home/mytemplates/../some_other_directory,
  174. i.e. outside of /home/mytemplates,
  175. is disallowed. This usage was never intended
  176. despite the lack of an explicit check.
  177. The main issue this causes
  178. is that module files can be written outside
  179. of the module root (or raise an error, if file perms aren't
  180. set up), and can also lead to the same template being
  181. cached in the lookup under multiple, relative roots.
  182. TemplateLookup instead has always supported multiple
  183. file roots for this purpose.
  184. [ticket:174]
  185. 0.4.2
  186. - Fixed bug regarding <%call>/def calls w/ content
  187. whereby the identity of the "caller" callable
  188. inside the <%def> would be corrupted by the
  189. presence of another <%call> in the same block.
  190. [ticket:170]
  191. - Fixed the babel plugin to accommodate <%block>
  192. [ticket:169]
  193. 0.4.1
  194. - New tag: <%block>. A variant on <%def> that
  195. evaluates its contents in-place.
  196. Can be named or anonymous,
  197. the named version is intended for inheritance
  198. layouts where any given section can be
  199. surrounded by the <%block> tag in order for
  200. it to become overrideable by inheriting
  201. templates, without the need to specify a
  202. top-level <%def> plus explicit call.
  203. Modified scoping and argument rules as well as a
  204. more strictly enforced usage scheme make it ideal
  205. for this purpose without at all replacing most
  206. other things that defs are still good for.
  207. Lots of new docs. [ticket:164]
  208. - a slight adjustment to the "highlight" logic
  209. for generating template bound stacktraces.
  210. Will stick to known template source lines
  211. without any extra guessing. [ticket:165]
  212. 0.4.0
  213. - A 20% speedup for a basic two-page
  214. inheritance setup rendering
  215. a table of escaped data
  216. (see http://techspot.zzzeek.org/2010/11/19/quick-mako-vs.-jinja-speed-test/).
  217. A few configurational changes which
  218. affect those in the I-don't-do-unicode
  219. camp should be noted below.
  220. - The FastEncodingBuffer is now used
  221. by default instead of cStringIO or StringIO,
  222. regardless of whether output_encoding
  223. is set to None or not. FEB is faster than
  224. both. Only StringIO allows bytestrings
  225. of unknown encoding to pass right
  226. through, however - while it is of course
  227. not recommended to send bytestrings of unknown
  228. encoding to the output stream, this
  229. mode of usage can be re-enabled by
  230. setting the flag bytestring_passthrough
  231. to True.
  232. - disable_unicode mode requires that
  233. output_encoding be set to None - it also
  234. forces the bytestring_passthrough flag
  235. to True.
  236. - the <%namespace> tag raises an error
  237. if the 'template' and 'module' attributes
  238. are specified at the same time in
  239. one tag. A different class is used
  240. for each case which allows a reduction in
  241. runtime conditional logic and function
  242. call overhead. [ticket:156]
  243. - the keys() in the Context, as well as
  244. it's internal _data dictionary, now
  245. include just what was specified to
  246. render() as well as Mako builtins
  247. 'caller', 'capture'. The contents
  248. of __builtin__ are no longer copied.
  249. Thanks to Daniel Lopez for pointing
  250. this out. [ticket:159]
  251. 0.3.6
  252. - Documentation is on Sphinx.
  253. [ticket:126]
  254. - Beaker is now part of "extras" in
  255. setup.py instead of "install_requires".
  256. This to produce a lighter weight install
  257. for those who don't use the caching
  258. as well as to conform to Pyramid
  259. deployment practices. [ticket:154]
  260. - The Beaker import (or attempt thereof)
  261. is delayed until actually needed;
  262. this to remove the performance penalty
  263. from startup, particularly for
  264. "single execution" environments
  265. such as shell scripts. [ticket:153]
  266. - Patch to lexer to not generate an empty
  267. '' write in the case of backslash-ended
  268. lines. [ticket:155]
  269. - Fixed missing **extra collection in
  270. setup.py which prevented setup.py
  271. from running 2to3 on install.
  272. [ticket:148]
  273. - New flag on Template, TemplateLookup -
  274. strict_undefined=True, will cause
  275. variables not found in the context to
  276. raise a NameError immediately, instead of
  277. defaulting to the UNDEFINED value.
  278. - The range of Python identifiers that
  279. are considered "undefined", meaning they
  280. are pulled from the context, has been
  281. trimmed back to not include variables
  282. declared inside of expressions (i.e. from
  283. list comprehensions), as well as
  284. in the argument list of lambdas. This
  285. to better support the strict_undefined
  286. feature. The change should be
  287. fully backwards-compatible but involved
  288. a little bit of tinkering in the AST code,
  289. which hadn't really been touched for
  290. a couple of years, just FYI.
  291. 0.3.5
  292. - The <%namespace> tag allows expressions
  293. for the `file` argument, i.e. with ${}.
  294. The `context` variable, if needed,
  295. must be referenced explicitly.
  296. [ticket:141]
  297. - ${} expressions embedded in tags,
  298. such as <%foo:bar x="${...}">, now
  299. allow multiline Python expressions.
  300. - Fixed previously non-covered regular
  301. expression, such that using a ${} expression
  302. inside of a tag element that doesn't allow
  303. them raises a CompileException instead of
  304. silently failing.
  305. - Added a try/except around "import markupsafe".
  306. This to support GAE which can't run markupsafe.
  307. [ticket:151] No idea whatsoever if the
  308. install_requires in setup.py also breaks GAE,
  309. couldn't get an answer on this.
  310. 0.3.4
  311. - Now using MarkupSafe for HTML escaping,
  312. i.e. in place of cgi.escape(). Faster
  313. C-based implementation and also escapes
  314. single quotes for additional security.
  315. Supports the __html__ attribute for
  316. the given expression as well.
  317. When using "disable_unicode" mode,
  318. a pure Python HTML escaper function
  319. is used which also quotes single quotes.
  320. Note that Pylons by default doesn't
  321. use Mako's filter - check your
  322. environment.py file.
  323. - Fixed call to "unicode.strip" in
  324. exceptions.text_error_template which
  325. is not Py3k compatible. [ticket:137]
  326. 0.3.3
  327. - Added conditional to RichTraceback
  328. such that if no traceback is passed
  329. and sys.exc_info() has been reset,
  330. the formatter just returns blank
  331. for the "traceback" portion.
  332. [ticket:135]
  333. - Fixed sometimes incorrect usage of
  334. exc.__class__.__name__
  335. in html/text error templates when using
  336. Python 2.4 [ticket:131]
  337. - Fixed broken @property decorator on
  338. template.last_modified
  339. - Fixed error formatting when a stacktrace
  340. line contains no line number, as in when
  341. inside an eval/exec-generated function.
  342. [ticket:132]
  343. - When a .py is being created, the tempfile
  344. where the source is stored temporarily is
  345. now made in the same directory as that of
  346. the .py file. This ensures that the two
  347. files share the same filesystem, thus
  348. avoiding cross-filesystem synchronization
  349. issues. Thanks to Charles Cazabon.
  350. 0.3.2
  351. - Calling a def from the top, via
  352. template.get_def(...).render() now checks the
  353. argument signature the same way as it did in
  354. 0.2.5, so that TypeError is not raised.
  355. reopen of [ticket:116]
  356. 0.3.1
  357. - Fixed incorrect dir name in setup.py
  358. [ticket:129]
  359. 0.3
  360. - Python 2.3 support is dropped. [ticket:123]
  361. - Python 3 support is added ! See README.py3k
  362. for installation and testing notes.
  363. [ticket:119]
  364. - Unit tests now run with nose. [ticket:127]
  365. - Source code escaping has been simplified.
  366. In particular, module source files are now
  367. generated with the Python "magic encoding
  368. comment", and source code is passed through
  369. mostly unescaped, except for that code which
  370. is regenerated from parsed Python source.
  371. This fixes usage of unicode in
  372. <%namespace:defname> tags. [ticket:99]
  373. - RichTraceback(), html_error_template().render(),
  374. text_error_template().render() now accept "error"
  375. and "traceback" as optional arguments, and
  376. these are now actually used. [ticket:122]
  377. - The exception output generated when
  378. format_exceptions=True will now be as a Python
  379. unicode if it occurred during render_unicode(),
  380. or an encoded string if during render().
  381. - A percent sign can be emitted as the first
  382. non-whitespace character on a line by escaping
  383. it as in "%%". [ticket:112]
  384. - Template accepts empty control structure, i.e.
  385. % if: %endif, etc. [ticket:94]
  386. - The <%page args> tag can now be used in a base
  387. inheriting template - the full set of render()
  388. arguments are passed down through the inherits
  389. chain. Undeclared arguments go into **pageargs
  390. as usual. [ticket:116]
  391. - defs declared within a <%namespace> section, an
  392. uncommon feature, have been improved. The defs
  393. no longer get doubly-rendered in the body() scope,
  394. and now allow local variable assignment without
  395. breakage. [ticket:109]
  396. - Windows paths are handled correctly if a Template
  397. is passed only an absolute filename (i.e. with c:
  398. drive etc.) and no URI - the URI is converted
  399. to a forward-slash path and module_directory
  400. is treated as a windows path. [ticket:128]
  401. - TemplateLookup raises TopLevelLookupException for
  402. a given path that is a directory, not a filename,
  403. instead of passing through to the template to
  404. generate IOError. [ticket:73]
  405. 0.2.6
  406. - Fix mako function decorators to preserve the
  407. original function's name in all cases. Patch
  408. from Scott Torborg.
  409. - Support the <%namespacename:defname> syntax in
  410. the babel extractor. [ticket:118]
  411. - Further fixes to unicode handling of .py files with the
  412. html_error_template. [ticket:88]
  413. 0.2.5
  414. - Added a "decorator" kw argument to <%def>,
  415. allows custom decoration functions to wrap
  416. rendering callables. Mainly intended for
  417. custom caching algorithms, not sure what
  418. other uses there may be (but there may be).
  419. Examples are in the "filtering" docs.
  420. - When Mako creates subdirectories in which
  421. to store templates, it uses the more
  422. permissive mode of 0775 instead of 0750,
  423. helping out with certain multi-process
  424. scenarios. Note that the mode is always
  425. subject to the restrictions of the existing
  426. umask. [ticket:101]
  427. - Fixed namespace.__getattr__() to raise
  428. AttributeError on attribute not found
  429. instead of RuntimeError. [ticket:104]
  430. - Added last_modified accessor to Template,
  431. returns the time.time() when the module
  432. was created. [ticket:97]
  433. - Fixed lexing support for whitespace
  434. around '=' sign in defs. [ticket:102]
  435. - Removed errant "lower()" in the lexer which
  436. was causing tags to compile with
  437. case-insensitive names, thus messing up
  438. custom <%call> names. [ticket:108]
  439. - added "mako.__version__" attribute to
  440. the base module. [ticket:110]
  441. 0.2.4
  442. - Fixed compatibility with Jython 2.5b1.
  443. 0.2.3
  444. - the <%namespacename:defname> syntax described at
  445. http://techspot.zzzeek.org/?p=28 has now
  446. been added as a built in syntax, and is recommended
  447. as a more modern syntax versus <%call expr="expression">.
  448. The %call tag itself will always remain,
  449. with <%namespacename:defname> presenting a more HTML-like
  450. alternative to calling defs, both plain and
  451. nested. Many examples of the new syntax are in the
  452. "Calling a def with embedded content" section
  453. of the docs.
  454. - added support for Jython 2.5.
  455. - cache module now uses Beaker's CacheManager
  456. object directly, so that all cache types are included.
  457. memcached is available as both "ext:memcached" and
  458. "memcached", the latter for backwards compatibility.
  459. - added "cache" accessor to Template, Namespace.
  460. e.g. ${local.cache.get('somekey')} or
  461. template.cache.invalidate_body()
  462. - added "cache_enabled=True" flag to Template,
  463. TemplateLookup. Setting this to False causes cache
  464. operations to "pass through" and execute every time;
  465. this flag should be integrated in Pylons with its own
  466. cache_enabled configuration setting.
  467. - the Cache object now supports invalidate_def(name),
  468. invalidate_body(), invalidate_closure(name),
  469. invalidate(key), which will remove the given key
  470. from the cache, if it exists. The cache arguments
  471. (i.e. storage type) are derived from whatever has
  472. been already persisted for that template.
  473. [ticket:92]
  474. - For cache changes to work fully, Beaker 1.1 is required.
  475. 1.0.1 and up will work as well with the exception of
  476. cache expiry. Note that Beaker 1.1 is **required**
  477. for applications which use dynamically generated keys,
  478. since previous versions will permanently store state in memory
  479. for each individual key, thus consuming all available
  480. memory for an arbitrarily large number of distinct
  481. keys.
  482. - fixed bug whereby an <%included> template with
  483. <%page> args named the same as a __builtin__ would not
  484. honor the default value specified in <%page> [ticket:93]
  485. - fixed the html_error_template not handling tracebacks from
  486. normal .py files with a magic encoding comment [ticket:88]
  487. - RichTraceback() now accepts an optional traceback object
  488. to be used in place of sys.exc_info()[2]. html_error_template()
  489. and text_error_template() accept an optional
  490. render()-time argument "traceback" which is passed to the
  491. RichTraceback object.
  492. - added ModuleTemplate class, which allows the construction
  493. of a Template given a Python module generated by a previous
  494. Template. This allows Python modules alone to be used
  495. as templates with no compilation step. Source code
  496. and template source are optional but allow error reporting
  497. to work correctly.
  498. - fixed Python 2.3 compat. in mako.pyparser [ticket:90]
  499. - fix Babel 0.9.3 compatibility; stripping comment tags is now
  500. optional (and enabled by default).
  501. 0.2.2
  502. - cached blocks now use the current context when rendering
  503. an expired section, instead of the original context
  504. passed in [ticket:87]
  505. - fixed a critical issue regarding caching, whereby
  506. a cached block would raise an error when called within a
  507. cache-refresh operation that was initiated after the
  508. initiating template had completed rendering.
  509. 0.2.1
  510. - fixed bug where 'output_encoding' parameter would prevent
  511. render_unicode() from returning a unicode object.
  512. - bumped magic number, which forces template recompile for
  513. this version (fixes incompatible compile symbols from 0.1
  514. series).
  515. - added a few docs for cache options, specifically those that
  516. help with memcached.
  517. 0.2.0
  518. - Speed improvements (as though we needed them, but people
  519. contributed and there you go):
  520. - added "bytestring passthru" mode, via
  521. `disable_unicode=True` argument passed to Template or
  522. TemplateLookup. All unicode-awareness and filtering is
  523. turned off, and template modules are generated with
  524. the appropriate magic encoding comment. In this mode,
  525. template expressions can only receive raw bytestrings
  526. or Unicode objects which represent straight ASCII, and
  527. render_unicode() may not be used if multibyte
  528. characters are present. When enabled, speed
  529. improvement around 10-20%. [ticket:77] (courtesy
  530. anonymous guest)
  531. - inlined the "write" function of Context into a local
  532. template variable. This affords a 12-30% speedup in
  533. template render time. (idea courtesy same anonymous
  534. guest) [ticket:76]
  535. - New Features, API changes:
  536. - added "attr" accessor to namespaces. Returns
  537. attributes configured as module level attributes, i.e.
  538. within <%! %> sections. [ticket:62] i.e.:
  539. # somefile.html
  540. <%!
  541. foo = 27
  542. %>
  543. # some other template
  544. <%namespace name="myns" file="somefile.html"/>
  545. ${myns.attr.foo}
  546. The slight backwards incompatibility here is, you
  547. can't have namespace defs named "attr" since the
  548. "attr" descriptor will occlude it.
  549. - cache_key argument can now render arguments passed
  550. directly to the %page or %def, i.e. <%def
  551. name="foo(x)" cached="True" cache_key="${x}"/>
  552. [ticket:78]
  553. - some functions on Context are now private:
  554. _push_buffer(), _pop_buffer(),
  555. caller_stack._push_frame(), caller_stack._pop_frame().
  556. - added a runner script "mako-render" which renders
  557. standard input as a template to stdout [ticket:81]
  558. [ticket:56]
  559. - Bugfixes:
  560. - can now use most names from __builtins__ as variable
  561. names without explicit declaration (i.e. 'id',
  562. 'exception', 'range', etc.) [ticket:83] [ticket:84]
  563. - can also use builtin names as local variable names
  564. (i.e. dict, locals) (came from fix for [ticket:84])
  565. - fixed bug in python generation when variable names are
  566. used with identifiers like "else", "finally", etc.
  567. inside them [ticket:68]
  568. - fixed codegen bug which occured when using <%page>
  569. level caching, combined with an expression-based
  570. cache_key, combined with the usage of <%namespace
  571. import="*"/> - fixed lexer exceptions not cleaning up
  572. temporary files, which could lead to a maximum number
  573. of file descriptors used in the process [ticket:69]
  574. - fixed issue with inline format_exceptions that was
  575. producing blank exception pages when an inheriting
  576. template is present [ticket:71]
  577. - format_exceptions will apply the encoding options of
  578. html_error_template() to the buffered output
  579. - rewrote the "whitespace adjuster" function to work
  580. with more elaborate combinations of quotes and
  581. comments [ticket:75]
  582. 0.1.10
  583. - fixed propagation of 'caller' such that nested %def calls
  584. within a <%call> tag's argument list propigates 'caller'
  585. to the %call function itself (propigates to the inner
  586. calls too, this is a slight side effect which previously
  587. existed anyway)
  588. - fixed bug where local.get_namespace() could put an
  589. incorrect "self" in the current context
  590. - fixed another namespace bug where the namespace functions
  591. did not have access to the correct context containing
  592. their 'self' and 'parent'
  593. 0.1.9
  594. - filters.Decode filter can also accept a non-basestring
  595. object and will call str() + unicode() on it [ticket:47]
  596. - comments can be placed at the end of control lines,
  597. i.e. if foo: # a comment, [ticket:53], thanks to
  598. Paul Colomiets
  599. - fixed expressions and page tag arguments and with embedded
  600. newlines in CRLF templates, follow up to [ticket:16], thanks
  601. Eric Woroshow
  602. - added an IOError catch for source file not found in RichTraceback
  603. exception reporter [ticket:51]
  604. 0.1.8
  605. - variable names declared in render methods by internal
  606. codegen prefixed by "__M_" to prevent name collisions
  607. with user code
  608. - added a Babel (http://babel.edgewall.org/) extractor entry
  609. point, allowing extraction of gettext messages directly from
  610. mako templates via Babel [ticket:45]
  611. - fix to turbogears plugin to work with dot-separated names
  612. (i.e. load_template('foo.bar')). also takes file extension
  613. as a keyword argument (default is 'mak').
  614. - more tg fix: fixed [ticket:35], allowing string-based
  615. templates with tgplugin even if non-compatible args were sent
  616. 0.1.7
  617. - one small fix to the unit tests to support python 2.3
  618. - a slight hack to how cache.py detects Beaker's memcached,
  619. works around unexplained import behavior observed on some
  620. python 2.3 installations
  621. 0.1.6
  622. - caching is now supplied directly by Beaker, which has
  623. all of MyghtyUtils merged into it now. The latest Beaker
  624. (0.7.1) also fixes a bug related to how Mako was using the
  625. cache API.
  626. - fix to module_directory path generation when the path is "./"
  627. [ticket:34]
  628. - TGPlugin passes options to string-based templates [ticket:35]
  629. - added an explicit stack frame step to template runtime, which
  630. allows much simpler and hopefully bug-free tracking of 'caller',
  631. fixes #28
  632. - if plain Python defs are used with <%call>, a decorator
  633. @runtime.supports_callable exists to ensure that the "caller"
  634. stack is properly handled for the def.
  635. - fix to RichTraceback and exception reporting to get template
  636. source code as a unicode object #37
  637. - html_error_template includes options "full=True", "css=True"
  638. which control generation of HTML tags, CSS [ticket:39]
  639. - added the 'encoding_errors' parameter to Template/TemplateLookup
  640. for specifying the error handler associated with encoding to
  641. 'output_encoding' [ticket:40]
  642. - the Template returned by html_error_template now defaults to
  643. output_encoding=sys.getdefaultencoding(),
  644. encoding_errors='htmlentityreplace' [ticket:37]
  645. - control lines, i.e. % lines, support backslashes to continue long
  646. lines (#32)
  647. - fixed codegen bug when defining <%def> within <%call> within <%call>
  648. - leading utf-8 BOM in template files is honored according to pep-0263
  649. 0.1.5
  650. - AST expression generation - added in just about everything
  651. expression-wise from the AST module [ticket:26]
  652. - AST parsing, properly detects imports of the form "import foo.bar"
  653. [ticket:27]
  654. - fix to lexing of <%docs> tag nested in other tags
  655. - fix to context-arguments inside of <%include> tag which broke
  656. during 0.1.4 [ticket:29]
  657. - added "n" filter, disables *all* filters normally applied to an expression
  658. via <%page> or default_filters (but not those within the filter)
  659. - added buffer_filters argument, defines filters applied to the return value
  660. of buffered/cached/filtered %defs, after all filters defined with the %def
  661. itself have been applied. allows the creation of default expression filters
  662. that let the output of return-valued %defs "opt out" of that filtering
  663. via passing special attributes or objects.
  664. 0.1.4
  665. - got defs-within-defs to be cacheable
  666. - fixes to code parsing/whitespace adjusting where plain python comments
  667. may contain quote characters [ticket:23]
  668. - fix to variable scoping for identifiers only referenced within
  669. functions
  670. - added a path normalization step to lookup so URIs like
  671. "/foo/bar/../etc/../foo" pre-process the ".." tokens before checking
  672. the filesystem
  673. - fixed/improved "caller" semantics so that undefined caller is
  674. "UNDEFINED", propigates __nonzero__ method so it evaulates to False if
  675. not present, True otherwise. this way you can say % if caller:\n
  676. ${caller.body()}\n% endif
  677. - <%include> has an "args" attribute that can pass arguments to the
  678. called template (keyword arguments only, must be declared in that
  679. page's <%page> tag.)
  680. - <%include> plus arguments is also programmatically available via
  681. self.include_file(<filename>, **kwargs)
  682. - further escaping added for multibyte expressions in %def, %call
  683. attributes [ticket:24]
  684. 0.1.3
  685. - ***Small Syntax Change*** - the single line comment character is now
  686. *two* hash signs, i.e. "## this is a comment". This avoids a common
  687. collection with CSS selectors.
  688. - the magic "coding" comment (i.e. # coding:utf-8) will still work with
  689. either one "#" sign or two for now; two is preferred going forward, i.e.
  690. ## coding:<someencoding>.
  691. - new multiline comment form: "<%doc> a comment </%doc>"
  692. - UNDEFINED evaluates to False
  693. - improvement to scoping of "caller" variable when using <%call> tag
  694. - added lexer error for unclosed control-line (%) line
  695. - added "preprocessor" argument to Template, TemplateLookup - is a single
  696. callable or list of callables which will be applied to the template text
  697. before lexing. given the text as an argument, returns the new text.
  698. - added mako.ext.preprocessors package, contains one preprocessor so far:
  699. 'convert_comments', which will convert single # comments to the new ##
  700. format
  701. 0.1.2
  702. - fix to parsing of code/expression blocks to insure that non-ascii
  703. characters, combined with a template that indicates a non-standard
  704. encoding, are expanded into backslash-escaped glyphs before being AST
  705. parsed [ticket:11]
  706. - all template lexing converts the template to unicode first, to
  707. immediately catch any encoding issues and ensure internal unicode
  708. representation.
  709. - added module_filename argument to Template to allow specification of a
  710. specific module file
  711. - added modulename_callable to TemplateLookup to allow a function to
  712. determine module filenames (takes filename, uri arguments). used for
  713. [ticket:14]
  714. - added optional input_encoding flag to Template, to allow sending a
  715. unicode() object with no magic encoding comment
  716. - "expression_filter" argument in <%page> applies only to expressions
  717. - added "default_filters" argument to Template, TemplateLookup. applies only
  718. to expressions, gets prepended to "expression_filter" arg from <%page>.
  719. defaults to ["unicode"], so that all expressions get stringified into u''
  720. by default (this is what Mako already does). By setting to [], expressions
  721. are passed through raw.
  722. - added "imports" argument to Template, TemplateLookup. so you can predefine
  723. a list of import statements at the top of the template. can be used in
  724. conjunction with default_filters.
  725. - support for CRLF templates...whoops ! welcome to all the windows users.
  726. [ticket:16]
  727. - small fix to local variable propigation for locals that are conditionally
  728. declared
  729. - got "top level" def calls to work, i.e. template.get_def("somedef").render()
  730. 0.1.1
  731. - buffet plugin supports string-based templates, allows ToscaWidgets to work
  732. [ticket:8]
  733. - AST parsing fixes: fixed TryExcept identifier parsing
  734. - removed textmate tmbundle from contrib and into separate SVN location;
  735. windows users cant handle those files, setuptools not very good at
  736. "pruning" certain directories
  737. - fix so that "cache_timeout" parameter is propigated
  738. - fix to expression filters so that string conversion (actually unicode)
  739. properly occurs before filtering
  740. - better error message when a lookup is attempted with a template that has no
  741. lookup
  742. - implemented "module" attribute for namespace
  743. - fix to code generation to correctly track multiple defs with the same name
  744. - "directories" can be passed to TemplateLookup as a scalar in which case it
  745. gets converted to a list [ticket:9]
  746. 0.1.0
  747. Initial release.