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 #1341 (closed defect: fixed)

Opened 11 years ago

Last modified 10 years ago

[PATCH] better error reporting in templates

Reported by: dalke Owned by: alberto
Priority: normal Milestone: 1.0.2
Component: unassigned Version: 1.0
Severity: normal Keywords:
Cc:

Description

We had a function "sid_url" attached to "tg" for global use across all templates. We got rid of it. One of the templates still used "tg.sid_url(..)". The error message was hard to diagnose because the raise AttributeError? did not include the variable name being looked up. Here is the patch to raise more informative errors. With it in place our problem was trivial to identify.

Index: util.py
===================================================================
--- util.py     (revision 2807)
+++ util.py     (working copy)
@@ -304,13 +304,13 @@
         try:
             del self[name]
         except KeyError:
-            raise AttributeError
+            raise AttributeError(name)
 
     def __getattr__(self, name):
         try:
             return self[name]
         except KeyError:
-            raise AttributeError
+            raise AttributeError(name)
 
 #XXX: Should issue Deprecation warning?
 DictObj = Bunch

Change History

comment:1 Changed 11 years ago by alberto

  • Owner set to alberto
  • Status changed from new to assigned
  • Summary changed from better error reporting in templates to [PATCH] better error reporting in templates

comment:2 Changed 11 years ago by alberto

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

Fixed at [2850]

Alberto

Note: See TracTickets for help on using tickets.