-
-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Labels
Description
Migrated issue, originally created by Michael Bayer (@zzzeek)
When it lists the backtrace, like:
('/home/wacky/build/Vigilia/env/lib/python2.6/site-packages/pylons/controllers/core.py',
105,
'_inspect_call',
'result = self._perform_call(func, args)'),
('/home/wacky/build/Vigilia/env/lib/python2.6/site-packages/pylons/controllers/core.py',
57,
'_perform_call',
'return func(**args)'),
('<string>', 2, 'edit_album', None),
('/home/wacky/build/Vigilia/vigilia/lib/base.py',
88,
'wrapper',
'return func(self, *args, **kwargs)'),
notice the <string>, 'edit_album', and None object. This None object is the cause. It should be converted to string, or Mako should know how to deal with it.
We get a None there when the function is a closure, or a returned function that dynamically generated, which is the case with most decorators.
The solution is a two-liner:
diff -r 6cf6461d778243d8a8986c658eb2246e5939bdce mako/exceptions.py
--- a/mako/exceptions.py Tue Apr 13 10:07:04 2010 -0400
+++ b/mako/exceptions.py Sat Apr 17 16:28:52 2010 -0400
@@ -152,6 +152,8 @@
rawrecords = traceback.extract_tb(trcback)
new_trcback = []
for filename, lineno, function, line in rawrecords:
+ if not line:
+ line = ''
try:
(line_map, template_lines) = mods[filename]
except KeyError:
}}