Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #16 (closed defect: fixed)

Opened 14 years ago

Last modified 9 years ago

Improved Kid error reporting

Reported by: kevin Owned by: jorge.vargas
Priority: normal Milestone: irrespective
Component: Kid Version:
Severity: normal Keywords: develix

Description (last modified by kevin) (diff)

Ian Bicking provided this hint:

Since I happened to be looking at the generated Python source while I figured out a problem ( http://lesscode.org/projects/kid/wiki/KidFaq#i-get-syntaxerror-unqualified-exec) I thought I'd note a way to improve tracebacks that occur inside Kid templates.

So you get this loop:

  for _e in [u"...", ...]:
      for _e2 in template_util.generate_content(_e): yield _e2

(template_util.generate_content should really be brought into the local scope to speed up the template, but that's an aside).

Anyway, if that could be changed to:

  for _e, __traceback_info__ in [(u"...", "File layout.html line 5
column 2"), ...]

Or something like that, then if you use Zope's ExceptionFormatter? (which ZPT uses for the same purpose) or paste.exception the line information will show up in the traceback. Or you can do something like:

  __traceback_supplement__ = [KidSupplement, self, None, None]
  for _e, _lineno, _column in [(u"...", 5, 2), ...]:
      __traceback_supplement__[2] = _lineno
      __traceback_supplement__[3] = _column

And then KidSupplment?(template, lineno, column) will be created on any error, and it can output all sorts of information (source position information being the most interesting). The specifics of the special variables are in the docstring here:  http://svn.pythonpaste.org/Paste/branches/mainline-refactor/paste/exceptions/collector.py (it adds a few things to the Zope exception formatter, but only a few -- traceback_hide and traceback_reporter). Anyway, I doubt I'll get around to doing it anytime soon, but I thought I'd note it, especially since it doesn't look that hard to add.

Change History

comment:1 Changed 14 years ago by kevin

  • Description modified (diff)

comment:2 Changed 14 years ago by kevin

  • Keywords sprint added

comment:3 Changed 14 years ago by anonymous

  • Owner changed from kevin to dstanek

comment:4 Changed 14 years ago by anonymous

The Kid trac also has a ticket for this bug:  http://lesscode.org/projects/kid/ticket/95

comment:5 Changed 14 years ago by anonymous

  • Component changed from Kid to Widgets

comment:6 Changed 14 years ago by michele

comment:7 Changed 14 years ago by kevin

Not exactly. The issue that this ticket is about is specifically to have Kid error messages that reflect what's wrong in your Kid template. Many times, the error message reflects what's wrong in the generated Python code, which is not helpful.

#86 is about giving TurboGears a nicer default error handler.

comment:8 Changed 14 years ago by kevin

  • Keywords develix added

comment:9 Changed 13 years ago by jorge.vargas

  • Component changed from Widgets to Kid
  • Milestone set to 1.1

comment:10 Changed 12 years ago by jorge.vargas

  • Component changed from Kid to genshi

this is no longer needed because we are switching over to genshi

comment:11 Changed 12 years ago by kskuhlman

  • Component changed from genshi to Kid

This issue is fixed in Kid 0.9.5. See Kid ticket #95 referenced earlier:  http://www.kid-templating.org/trac/ticket/95

I've been working with it for the past couple of weeks, and it works great. Since this is one of the top reasons for migrating away from Kid, perhaps the version requirement should be bumped in the meantime?

comment:12 Changed 12 years ago by jorge.vargas

  • Owner changed from dstanek to jorge.vargas

yes indeed I have that in my list of pending items. I'll make the bump to turbokid. but we need to double check all our tests for the caps change in 0.9.4

comment:13 Changed 12 years ago by alberto

  • Milestone changed from 1.1 to __unclassified__

Batch moved into unclassified from 1.1 to properly track progress on the later

comment:14 Changed 12 years ago by alberto

  • Keywords sprint removed

comment:15 Changed 11 years ago by khorn

  • Status changed from new to closed
  • Resolution set to fixed

It appears that this ticket is no longer needed. A fix of sorts has been implemented in Kid, and the Kid ticket regarding this issue is closed.

Closing. If you have an objection, please reopen this ticket.

comment:16 Changed 9 years ago by chrisz

  • Milestone changed from __unclassified__ to irrespective
Note: See TracTickets for help on using tickets.