diff options
author | Cody Taylor <codemister99@yahoo.com> | 2015-03-24 20:57:02 -0400 |
---|---|---|
committer | Cody Taylor <codemister99@yahoo.com> | 2015-03-24 20:57:47 -0400 |
commit | 52e8c0a3deaae9017c76a17196aeac8b027b933e (patch) | |
tree | 77179e4d936cd6e6de938ef98bc1e8fc5f88c0a1 /mako | |
parent | b6d0479034e4f379576caa6eb9ef3e32369c333f (diff) | |
download | external_python_mako-52e8c0a3deaae9017c76a17196aeac8b027b933e.tar.gz external_python_mako-52e8c0a3deaae9017c76a17196aeac8b027b933e.tar.bz2 external_python_mako-52e8c0a3deaae9017c76a17196aeac8b027b933e.zip |
Add STOP_RENDERING keyword; exiting of a template.
Signed-off-by: Cody Taylor <codemister99@yahoo.com>
Diffstat (limited to 'mako')
-rw-r--r-- | mako/__init__.py | 2 | ||||
-rw-r--r-- | mako/codegen.py | 3 | ||||
-rw-r--r-- | mako/runtime.py | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/mako/__init__.py b/mako/__init__.py index d963848..59d4060 100644 --- a/mako/__init__.py +++ b/mako/__init__.py @@ -5,4 +5,4 @@ # the MIT License: http://www.opensource.org/licenses/mit-license.php -__version__ = '1.0.1' +__version__ = '1.0.2' diff --git a/mako/codegen.py b/mako/codegen.py index 4b0bda8..0226415 100644 --- a/mako/codegen.py +++ b/mako/codegen.py @@ -19,7 +19,7 @@ MAGIC_NUMBER = 10 # names which are hardwired into the # template and are not accessed via the # context itself -RESERVED_NAMES = set(['context', 'loop', 'UNDEFINED']) +RESERVED_NAMES = set(['context', 'loop', 'UNDEFINED', 'STOP_RENDERING']) def compile(node, uri, @@ -215,6 +215,7 @@ class _GenerateRenderMethod(object): (", ".join(self.compiler.future_imports),)) self.printer.writeline("from mako import runtime, filters, cache") self.printer.writeline("UNDEFINED = runtime.UNDEFINED") + self.printer.writeline("STOP_RENDERING = runtime.STOP_RENDERING") self.printer.writeline("__M_dict_builtin = dict") self.printer.writeline("__M_locals_builtin = locals") self.printer.writeline("_magic_number = %r" % MAGIC_NUMBER) diff --git a/mako/runtime.py b/mako/runtime.py index 6b6a35a..870efcc 100644 --- a/mako/runtime.py +++ b/mako/runtime.py @@ -228,6 +228,7 @@ class Undefined(object): return False UNDEFINED = Undefined() +STOP_RENDERING = "" class LoopStack(object): """a stack for LoopContexts that implements the context manager protocol |