Improved Jinja's debugging support by introducing "@internalcode" which marks code objects that are skipped on tracebacks. Also template errors are now translated as well to help the pylons debugger.
--HG--
branch : trunk
diff --git a/jinja2/utils.py b/jinja2/utils.py
index 1ae38e0..6c3805a 100644
--- a/jinja2/utils.py
+++ b/jinja2/utils.py
@@ -35,6 +35,9 @@
# special singleton representing missing values for the runtime
missing = type('MissingType', (), {'__repr__': lambda x: 'missing'})()
+# internal code
+internal_code = set()
+
# concatenate a list of strings and convert them to unicode.
# unfortunately there is a bug in python 2.4 and lower that causes
@@ -120,6 +123,12 @@
return f
+def internalcode(f):
+ """Marks the function as internally used"""
+ internal_code.add(f.func_code)
+ return f
+
+
def is_undefined(obj):
"""Check if the object passed is undefined. This does nothing more than
performing an instance check against :class:`Undefined` but looks nicer.