#167: Apache/WSGI Integration
I modified the run_wsgi.py file to work directly in Apache to enable PHP-style pages written in Mako. I don't want to offend the purists :), but there are times when full app stacks like Pylons or...
View Article#150: Line ending handling broken on Win32 platform
Version 0.3.4 Line ending handling of templates is broken on Windows: For each "CR-LF" sequence in the template file you get "CR-CR-LF" in the output. This only happens when using the filename...
View Article#149: Add new filter "nbsp"
Hi, What do you think about adding a filter for non-breaking spaces? I assume that it could be very help full for a lot of people. Example:diff -r 4dc291a1bc1c mako/filters.py --- a/mako/filters.py...
View Article#197: "Try" blocks don't support the "else" ternary keyword.
parsetree.py:96 needs to be: 'try':set(['except','else','finally']), ...but I don't know enough about Mako internally to know what else (hehe) is required to make this work.
View Article#196: No way to import from __future__
<%! from __future__ import division %> on the first line of a file doesn't work, because the import doesn't end up as the first statement in the resulting Python module. Hardly a show-stopper,...
View Article#195: Control statements don't follow line-wrapping rules
% for item in [ 'some', 'long', 'list', 'of', 'items', ]: ${item} % endfor Produces: CompileException: Fragment 'for item in [' is not a partial control statement in file... Adding backslashes to the...
View Article#145: continue / break control statements?
Hi, I was wondering how to use control/break within a loop. I didn't find anything in the docs, so I tried this: % for i in range(10): % if i == 3: % continue % endif ${i} % endfor That didn't work,...
View Article#140: inconsistent behavior of filter pulling from context based on name
this is related to #3 but seems different frommako.templateimport Template x = Template(""" X: ${"asdf" | h.foo} """) y = Template(""" Y: ${"asdf" | z.foo} """) z = Template(""" Z: ${h} ${"asdf" |...
View Article#136: Suggestion: Custom Python message extractor in the Babel plugin
I use a gettext wrapper function with slightly modified semantics. I have written a Python message extractor for it, and now I would like to use the same extractor also in Mako. Would it be possible...
View Article#3: functions declared in filter="" attributes do not pull from the Context
i.e. <%namespace name="foo" file="func.html"/> <%def name="lala" filter="foo.bar"> etc </%def> the "foo" namespace will not get pulled out from the Context into the local python...
View Article#199: steal/port jinja2's debug.py exception rewriting logic
The mako-render render script is useful for rendering templates in a non-html environment (eg I use it to generate c++ code ...) It currently doesn't produce usable tracebacks when there is an error...
View Article#190: Using lambda as default argument breaks
Running this code: from mako.template import Template TEXT = """\ <%def name="foo(bar=lambda x, y: x + y)"> bar(4700, 11) </%def> ${foo()} """ print(Template(TEXT).render()) ...results in:...
View Article#184: Template.render_context(context) (re)sets context['self']
I'm not quite positive that this is a bug, but I’m pretty sure it is. When Template.render_context() is called, it sets contextself?. So, if one renders another template like this:...
View Article#172: Clarify license in _ast_util.py
mako/_ast_util.py has the standard mako header at the top listing copyright holder as the mako authors and license terms as MIT. But the docstring that immediately follows says that the copyright...
View Article#171: default filters should be applied last
Maybe I am wrong here, but shouldn't default filters such as unicode() be applied last? The fact that it's done the exactly opposite way makes it a pain, as we are limited to deal with the...
View Article#168: variables implicitly passed to block cause unexpected error for def
Try out the following 3-level inheritance setup, stripped down to show only the situation I want to point out: Test setup: #base.mako: <%block name="foo"/> #middle.mako: <%inherit...
View Article#160: add source namespace to get_def() ?
When render() is called, runtime will pull out the requested namespace after _populate_self_namespace is called and effectively run whatever named def relative to that namespace, such as self. The...
View Article#111: mention defs can return data / better buffering explanation
Today I (finally) got how "buffering" works. I think documentation could do better at explaining how this things work behind mako scenes. First of all, all ${ call_some_function() } *should* be...
View Article#98: remove amateurish pythonisms
this includes: super long lines of code, lets chop them all at 60 chars or whatever pep8 calls for this beauty: [module_identifiers.declared.add(x) for x in ["UNDEFINED"]] and also this:...
View Article#85: need to not call imp.load_source to work with GAE
Per a comment here: http://code.google.com/p/appengine-monkey/wiki/Pylons I was briefly confused by the following error: Error - <type 'exceptions.AttributeError'>: 'module' object has no...
View Article