CHANGES 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. 0.3.4
  2. - Now using MarkupSafe for HTML escaping,
  3. i.e. in place of cgi.escape(). Faster
  4. C-based implementation and also escapes
  5. single quotes for additional security.
  6. Supports the __html__ attribute for
  7. the given expression as well.
  8. When using "disable_unicode" mode,
  9. a pure Python HTML escaper function
  10. is used which also quotes single quotes.
  11. Note that Pylons by default doesn't
  12. use Mako's filter - check your
  13. environment.py file.
  14. - Fixed call to "unicode.strip" in
  15. exceptions.text_error_template which
  16. is not Py3k compatible. [ticket:137]
  17. 0.3.3
  18. - Added conditional to RichTraceback
  19. such that if no traceback is passed
  20. and sys.exc_info() has been reset,
  21. the formatter just returns blank
  22. for the "traceback" portion.
  23. [ticket:135]
  24. - Fixed sometimes incorrect usage of
  25. exc.__class__.__name__
  26. in html/text error templates when using
  27. Python 2.4 [ticket:131]
  28. - Fixed broken @property decorator on
  29. template.last_modified
  30. - Fixed error formatting when a stacktrace
  31. line contains no line number, as in when
  32. inside an eval/exec-generated function.
  33. [ticket:132]
  34. - When a .py is being created, the tempfile
  35. where the source is stored temporarily is
  36. now made in the same directory as that of
  37. the .py file. This ensures that the two
  38. files share the same filesystem, thus
  39. avoiding cross-filesystem synchronization
  40. issues. Thanks to Charles Cazabon.
  41. 0.3.2
  42. - Calling a def from the top, via
  43. template.get_def(...).render() now checks the
  44. argument signature the same way as it did in
  45. 0.2.5, so that TypeError is not raised.
  46. reopen of [ticket:116]
  47. 0.3.1
  48. - Fixed incorrect dir name in setup.py
  49. [ticket:129]
  50. 0.3
  51. - Python 2.3 support is dropped. [ticket:123]
  52. - Python 3 support is added ! See README.py3k
  53. for installation and testing notes.
  54. [ticket:119]
  55. - Unit tests now run with nose. [ticket:127]
  56. - Source code escaping has been simplified.
  57. In particular, module source files are now
  58. generated with the Python "magic encoding
  59. comment", and source code is passed through
  60. mostly unescaped, except for that code which
  61. is regenerated from parsed Python source.
  62. This fixes usage of unicode in
  63. <%namespace:defname> tags. [ticket:99]
  64. - RichTraceback(), html_error_template().render(),
  65. text_error_template().render() now accept "error"
  66. and "traceback" as optional arguments, and
  67. these are now actually used. [ticket:122]
  68. - The exception output generated when
  69. format_exceptions=True will now be as a Python
  70. unicode if it occurred during render_unicode(),
  71. or an encoded string if during render().
  72. - A percent sign can be emitted as the first
  73. non-whitespace character on a line by escaping
  74. it as in "%%". [ticket:112]
  75. - Template accepts empty control structure, i.e.
  76. % if: %endif, etc. [ticket:94]
  77. - The <%page args> tag can now be used in a base
  78. inheriting template - the full set of render()
  79. arguments are passed down through the inherits
  80. chain. Undeclared arguments go into **pageargs
  81. as usual. [ticket:116]
  82. - defs declared within a <%namespace> section, an
  83. uncommon feature, have been improved. The defs
  84. no longer get doubly-rendered in the body() scope,
  85. and now allow local variable assignment without
  86. breakage. [ticket:109]
  87. - Windows paths are handled correctly if a Template
  88. is passed only an absolute filename (i.e. with c:
  89. drive etc.) and no URI - the URI is converted
  90. to a forward-slash path and module_directory
  91. is treated as a windows path. [ticket:128]
  92. - TemplateLookup raises TopLevelLookupException for
  93. a given path that is a directory, not a filename,
  94. instead of passing through to the template to
  95. generate IOError. [ticket:73]
  96. 0.2.6
  97. - Fix mako function decorators to preserve the
  98. original function's name in all cases. Patch
  99. from Scott Torborg.
  100. - Support the <%namespacename:defname> syntax in
  101. the babel extractor. [ticket:118]
  102. - Further fixes to unicode handling of .py files with the
  103. html_error_template. [ticket:88]
  104. 0.2.5
  105. - Added a "decorator" kw argument to <%def>,
  106. allows custom decoration functions to wrap
  107. rendering callables. Mainly intended for
  108. custom caching algorithms, not sure what
  109. other uses there may be (but there may be).
  110. Examples are in the "filtering" docs.
  111. - When Mako creates subdirectories in which
  112. to store templates, it uses the more
  113. permissive mode of 0775 instead of 0750,
  114. helping out with certain multi-process
  115. scenarios. Note that the mode is always
  116. subject to the restrictions of the existing
  117. umask. [ticket:101]
  118. - Fixed namespace.__getattr__() to raise
  119. AttributeError on attribute not found
  120. instead of RuntimeError. [ticket:104]
  121. - Added last_modified accessor to Template,
  122. returns the time.time() when the module
  123. was created. [ticket:97]
  124. - Fixed lexing support for whitespace
  125. around '=' sign in defs. [ticket:102]
  126. - Removed errant "lower()" in the lexer which
  127. was causing tags to compile with
  128. case-insensitive names, thus messing up
  129. custom <%call> names. [ticket:108]
  130. - added "mako.__version__" attribute to
  131. the base module. [ticket:110]
  132. 0.2.4
  133. - Fixed compatibility with Jython 2.5b1.
  134. 0.2.3
  135. - the <%namespacename:defname> syntax described at
  136. http://techspot.zzzeek.org/?p=28 has now
  137. been added as a built in syntax, and is recommended
  138. as a more modern syntax versus <%call expr="expression">.
  139. The %call tag itself will always remain,
  140. with <%namespacename:defname> presenting a more HTML-like
  141. alternative to calling defs, both plain and
  142. nested. Many examples of the new syntax are in the
  143. "Calling a def with embedded content" section
  144. of the docs.
  145. - added support for Jython 2.5.
  146. - cache module now uses Beaker's CacheManager
  147. object directly, so that all cache types are included.
  148. memcached is available as both "ext:memcached" and
  149. "memcached", the latter for backwards compatibility.
  150. - added "cache" accessor to Template, Namespace.
  151. e.g. ${local.cache.get('somekey')} or
  152. template.cache.invalidate_body()
  153. - added "cache_enabled=True" flag to Template,
  154. TemplateLookup. Setting this to False causes cache
  155. operations to "pass through" and execute every time;
  156. this flag should be integrated in Pylons with its own
  157. cache_enabled configuration setting.
  158. - the Cache object now supports invalidate_def(name),
  159. invalidate_body(), invalidate_closure(name),
  160. invalidate(key), which will remove the given key
  161. from the cache, if it exists. The cache arguments
  162. (i.e. storage type) are derived from whatever has
  163. been already persisted for that template.
  164. [ticket:92]
  165. - For cache changes to work fully, Beaker 1.1 is required.
  166. 1.0.1 and up will work as well with the exception of
  167. cache expiry. Note that Beaker 1.1 is **required**
  168. for applications which use dynamically generated keys,
  169. since previous versions will permanently store state in memory
  170. for each individual key, thus consuming all available
  171. memory for an arbitrarily large number of distinct
  172. keys.
  173. - fixed bug whereby an <%included> template with
  174. <%page> args named the same as a __builtin__ would not
  175. honor the default value specified in <%page> [ticket:93]
  176. - fixed the html_error_template not handling tracebacks from
  177. normal .py files with a magic encoding comment [ticket:88]
  178. - RichTraceback() now accepts an optional traceback object
  179. to be used in place of sys.exc_info()[2]. html_error_template()
  180. and text_error_template() accept an optional
  181. render()-time argument "traceback" which is passed to the
  182. RichTraceback object.
  183. - added ModuleTemplate class, which allows the construction
  184. of a Template given a Python module generated by a previous
  185. Template. This allows Python modules alone to be used
  186. as templates with no compilation step. Source code
  187. and template source are optional but allow error reporting
  188. to work correctly.
  189. - fixed Python 2.3 compat. in mako.pyparser [ticket:90]
  190. - fix Babel 0.9.3 compatibility; stripping comment tags is now
  191. optional (and enabled by default).
  192. 0.2.2
  193. - cached blocks now use the current context when rendering
  194. an expired section, instead of the original context
  195. passed in [ticket:87]
  196. - fixed a critical issue regarding caching, whereby
  197. a cached block would raise an error when called within a
  198. cache-refresh operation that was initiated after the
  199. initiating template had completed rendering.
  200. 0.2.1
  201. - fixed bug where 'output_encoding' parameter would prevent
  202. render_unicode() from returning a unicode object.
  203. - bumped magic number, which forces template recompile for
  204. this version (fixes incompatible compile symbols from 0.1
  205. series).
  206. - added a few docs for cache options, specifically those that
  207. help with memcached.
  208. 0.2.0
  209. - Speed improvements (as though we needed them, but people
  210. contributed and there you go):
  211. - added "bytestring passthru" mode, via
  212. `disable_unicode=True` argument passed to Template or
  213. TemplateLookup. All unicode-awareness and filtering is
  214. turned off, and template modules are generated with
  215. the appropriate magic encoding comment. In this mode,
  216. template expressions can only receive raw bytestrings
  217. or Unicode objects which represent straight ASCII, and
  218. render_unicode() may not be used if multibyte
  219. characters are present. When enabled, speed
  220. improvement around 10-20%. [ticket:77] (courtesy
  221. anonymous guest)
  222. - inlined the "write" function of Context into a local
  223. template variable. This affords a 12-30% speedup in
  224. template render time. (idea courtesy same anonymous
  225. guest) [ticket:76]
  226. - New Features, API changes:
  227. - added "attr" accessor to namespaces. Returns
  228. attributes configured as module level attributes, i.e.
  229. within <%! %> sections. [ticket:62] i.e.:
  230. # somefile.html
  231. <%!
  232. foo = 27
  233. %>
  234. # some other template
  235. <%namespace name="myns" file="somefile.html"/>
  236. ${myns.attr.foo}
  237. The slight backwards incompatibility here is, you
  238. can't have namespace defs named "attr" since the
  239. "attr" descriptor will occlude it.
  240. - cache_key argument can now render arguments passed
  241. directly to the %page or %def, i.e. <%def
  242. name="foo(x)" cached="True" cache_key="${x}"/>
  243. [ticket:78]
  244. - some functions on Context are now private:
  245. _push_buffer(), _pop_buffer(),
  246. caller_stack._push_frame(), caller_stack._pop_frame().
  247. - added a runner script "mako-render" which renders
  248. standard input as a template to stdout [ticket:81]
  249. [ticket:56]
  250. - Bugfixes:
  251. - can now use most names from __builtins__ as variable
  252. names without explicit declaration (i.e. 'id',
  253. 'exception', 'range', etc.) [ticket:83] [ticket:84]
  254. - can also use builtin names as local variable names
  255. (i.e. dict, locals) (came from fix for [ticket:84])
  256. - fixed bug in python generation when variable names are
  257. used with identifiers like "else", "finally", etc.
  258. inside them [ticket:68]
  259. - fixed codegen bug which occured when using <%page>
  260. level caching, combined with an expression-based
  261. cache_key, combined with the usage of <%namespace
  262. import="*"/> - fixed lexer exceptions not cleaning up
  263. temporary files, which could lead to a maximum number
  264. of file descriptors used in the process [ticket:69]
  265. - fixed issue with inline format_exceptions that was
  266. producing blank exception pages when an inheriting
  267. template is present [ticket:71]
  268. - format_exceptions will apply the encoding options of
  269. html_error_template() to the buffered output
  270. - rewrote the "whitespace adjuster" function to work
  271. with more elaborate combinations of quotes and
  272. comments [ticket:75]
  273. 0.1.10
  274. - fixed propagation of 'caller' such that nested %def calls
  275. within a <%call> tag's argument list propigates 'caller'
  276. to the %call function itself (propigates to the inner
  277. calls too, this is a slight side effect which previously
  278. existed anyway)
  279. - fixed bug where local.get_namespace() could put an
  280. incorrect "self" in the current context
  281. - fixed another namespace bug where the namespace functions
  282. did not have access to the correct context containing
  283. their 'self' and 'parent'
  284. 0.1.9
  285. - filters.Decode filter can also accept a non-basestring
  286. object and will call str() + unicode() on it [ticket:47]
  287. - comments can be placed at the end of control lines,
  288. i.e. if foo: # a comment, [ticket:53], thanks to
  289. Paul Colomiets
  290. - fixed expressions and page tag arguments and with embedded
  291. newlines in CRLF templates, follow up to [ticket:16], thanks
  292. Eric Woroshow
  293. - added an IOError catch for source file not found in RichTraceback
  294. exception reporter [ticket:51]
  295. 0.1.8
  296. - variable names declared in render methods by internal
  297. codegen prefixed by "__M_" to prevent name collisions
  298. with user code
  299. - added a Babel (http://babel.edgewall.org/) extractor entry
  300. point, allowing extraction of gettext messages directly from
  301. mako templates via Babel [ticket:45]
  302. - fix to turbogears plugin to work with dot-separated names
  303. (i.e. load_template('foo.bar')). also takes file extension
  304. as a keyword argument (default is 'mak').
  305. - more tg fix: fixed [ticket:35], allowing string-based
  306. templates with tgplugin even if non-compatible args were sent
  307. 0.1.7
  308. - one small fix to the unit tests to support python 2.3
  309. - a slight hack to how cache.py detects Beaker's memcached,
  310. works around unexplained import behavior observed on some
  311. python 2.3 installations
  312. 0.1.6
  313. - caching is now supplied directly by Beaker, which has
  314. all of MyghtyUtils merged into it now. The latest Beaker
  315. (0.7.1) also fixes a bug related to how Mako was using the
  316. cache API.
  317. - fix to module_directory path generation when the path is "./"
  318. [ticket:34]
  319. - TGPlugin passes options to string-based templates [ticket:35]
  320. - added an explicit stack frame step to template runtime, which
  321. allows much simpler and hopefully bug-free tracking of 'caller',
  322. fixes #28
  323. - if plain Python defs are used with <%call>, a decorator
  324. @runtime.supports_callable exists to ensure that the "caller"
  325. stack is properly handled for the def.
  326. - fix to RichTraceback and exception reporting to get template
  327. source code as a unicode object #37
  328. - html_error_template includes options "full=True", "css=True"
  329. which control generation of HTML tags, CSS [ticket:39]
  330. - added the 'encoding_errors' parameter to Template/TemplateLookup
  331. for specifying the error handler associated with encoding to
  332. 'output_encoding' [ticket:40]
  333. - the Template returned by html_error_template now defaults to
  334. output_encoding=sys.getdefaultencoding(),
  335. encoding_errors='htmlentityreplace' [ticket:37]
  336. - control lines, i.e. % lines, support backslashes to continue long
  337. lines (#32)
  338. - fixed codegen bug when defining <%def> within <%call> within <%call>
  339. - leading utf-8 BOM in template files is honored according to pep-0263
  340. 0.1.5
  341. - AST expression generation - added in just about everything
  342. expression-wise from the AST module [ticket:26]
  343. - AST parsing, properly detects imports of the form "import foo.bar"
  344. [ticket:27]
  345. - fix to lexing of <%docs> tag nested in other tags
  346. - fix to context-arguments inside of <%include> tag which broke
  347. during 0.1.4 [ticket:29]
  348. - added "n" filter, disables *all* filters normally applied to an expression
  349. via <%page> or default_filters (but not those within the filter)
  350. - added buffer_filters argument, defines filters applied to the return value
  351. of buffered/cached/filtered %defs, after all filters defined with the %def
  352. itself have been applied. allows the creation of default expression filters
  353. that let the output of return-valued %defs "opt out" of that filtering
  354. via passing special attributes or objects.
  355. 0.1.4
  356. - got defs-within-defs to be cacheable
  357. - fixes to code parsing/whitespace adjusting where plain python comments
  358. may contain quote characters [ticket:23]
  359. - fix to variable scoping for identifiers only referenced within
  360. functions
  361. - added a path normalization step to lookup so URIs like
  362. "/foo/bar/../etc/../foo" pre-process the ".." tokens before checking
  363. the filesystem
  364. - fixed/improved "caller" semantics so that undefined caller is
  365. "UNDEFINED", propigates __nonzero__ method so it evaulates to False if
  366. not present, True otherwise. this way you can say % if caller:\n
  367. ${caller.body()}\n% endif
  368. - <%include> has an "args" attribute that can pass arguments to the
  369. called template (keyword arguments only, must be declared in that
  370. page's <%page> tag.)
  371. - <%include> plus arguments is also programmatically available via
  372. self.include_file(<filename>, **kwargs)
  373. - further escaping added for multibyte expressions in %def, %call
  374. attributes [ticket:24]
  375. 0.1.3
  376. - ***Small Syntax Change*** - the single line comment character is now
  377. *two* hash signs, i.e. "## this is a comment". This avoids a common
  378. collection with CSS selectors.
  379. - the magic "coding" comment (i.e. # coding:utf-8) will still work with
  380. either one "#" sign or two for now; two is preferred going forward, i.e.
  381. ## coding:<someencoding>.
  382. - new multiline comment form: "<%doc> a comment </%doc>"
  383. - UNDEFINED evaluates to False
  384. - improvement to scoping of "caller" variable when using <%call> tag
  385. - added lexer error for unclosed control-line (%) line
  386. - added "preprocessor" argument to Template, TemplateLookup - is a single
  387. callable or list of callables which will be applied to the template text
  388. before lexing. given the text as an argument, returns the new text.
  389. - added mako.ext.preprocessors package, contains one preprocessor so far:
  390. 'convert_comments', which will convert single # comments to the new ##
  391. format
  392. 0.1.2
  393. - fix to parsing of code/expression blocks to insure that non-ascii
  394. characters, combined with a template that indicates a non-standard
  395. encoding, are expanded into backslash-escaped glyphs before being AST
  396. parsed [ticket:11]
  397. - all template lexing converts the template to unicode first, to
  398. immediately catch any encoding issues and ensure internal unicode
  399. representation.
  400. - added module_filename argument to Template to allow specification of a
  401. specific module file
  402. - added modulename_callable to TemplateLookup to allow a function to
  403. determine module filenames (takes filename, uri arguments). used for
  404. [ticket:14]
  405. - added optional input_encoding flag to Template, to allow sending a
  406. unicode() object with no magic encoding comment
  407. - "expression_filter" argument in <%page> applies only to expressions
  408. - added "default_filters" argument to Template, TemplateLookup. applies only
  409. to expressions, gets prepended to "expression_filter" arg from <%page>.
  410. defaults to ["unicode"], so that all expressions get stringified into u''
  411. by default (this is what Mako already does). By setting to [], expressions
  412. are passed through raw.
  413. - added "imports" argument to Template, TemplateLookup. so you can predefine
  414. a list of import statements at the top of the template. can be used in
  415. conjunction with default_filters.
  416. - support for CRLF templates...whoops ! welcome to all the windows users.
  417. [ticket:16]
  418. - small fix to local variable propigation for locals that are conditionally
  419. declared
  420. - got "top level" def calls to work, i.e. template.get_def("somedef").render()
  421. 0.1.1
  422. - buffet plugin supports string-based templates, allows ToscaWidgets to work
  423. [ticket:8]
  424. - AST parsing fixes: fixed TryExcept identifier parsing
  425. - removed textmate tmbundle from contrib and into separate SVN location;
  426. windows users cant handle those files, setuptools not very good at
  427. "pruning" certain directories
  428. - fix so that "cache_timeout" parameter is propigated
  429. - fix to expression filters so that string conversion (actually unicode)
  430. properly occurs before filtering
  431. - better error message when a lookup is attempted with a template that has no
  432. lookup
  433. - implemented "module" attribute for namespace
  434. - fix to code generation to correctly track multiple defs with the same name
  435. - "directories" can be passed to TemplateLookup as a scalar in which case it
  436. gets converted to a list [ticket:9]
  437. 0.1.0
  438. Initial release.