Django is forced to catch your errors, and then bubble them back up to
you.  If you notice, none of the traceback lines are even in your
code-- it's all in Python libs or an Django code.  The issue is that
you're not seeing raw exceptions, but instead you're seeing reproduced
exceptions.

I agree that template tags are had to debug, especially when it's a
big complex tag that goes wrong all of the sudden.  However, don't
forget that it's just a Python object or method, just why not fire up
the shell and import it, testing it out?  Step through it with input
that you *know* you're getting, and use the Django modules to create
dummy contexts if needed (although you could probably get away with
just Python dict objects, since the template rendering engine won't
actually be involved).

Fixing the reporting would be amazingly welcome by many of us, but
it's not like it's a simple matter of printing a single debug variable
that accidentally got omitted.  I don't know enough about how Django
bubbles exceptions, so I can't say much more on the subject, but it's
clear to me that it's not something that they're doing on purpose to
spit us all.

Tim

On Nov 27, 3:58 am, "KONTRA, Gergely" <pihent...@gmail.com> wrote:
> Seems like you built your own project, and not using my zip.
>
> However, the result IS different.
>
> In my traceback I do not have any snippet referencing customtag.py.
>
> See my trace:http://dpaste.com/hold/125819/
>
> thanks
> Gergo
> +-[ Gergely Kontra <pihent...@gmail.com> ]------------------+
> |                                                           |
> | Mobile:(+36 20)356 9656                                   |
> |                                                           |
> +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
>
>
>
> On Fri, Nov 27, 2009 at 04:38, Karen Tracey <kmtra...@gmail.com> wrote:
> > On Thu, Nov 26, 2009 at 6:02 PM, KONTRA, Gergely <pihent...@gmail.com>
> > wrote:
>
> >> My problem is the error handling of django in templatetags, not the
> >> specific dummy error, which I programmed:
>
> >> @register.simple_tag
> >> def current_time():
> >>        1/0
> >>        return unicode(datetime.datetime.now())
>
> >> What annoys me, that you cannot find the line number of the error,
> >> just a message, that somewhere there is an error rendering the
> >> current_time tag.
>
> > With DEBUG=True, TEMPLATE_DEBUG=DEBUG, I get a TemplateSyntaxError debug
> > page with exception value:
>
> > Caught an exception while rendering: integer division or modulo by zero
>
> > Original Traceback (most recent call last):
> >   File "d:\u\kmt\django\trunk\django\template\debug.py", line 71, in
> > render_node
> >     result = node.render(context)
> >   File "d:\u\kmt\django\trunk\django\template\__init__.py", line 909, in
> > render
> >     return func(*resolved_vars)
> >   File "D:\u\kmt\software\web\playground\ttt\templatetags\tstuff.py", line
> > 6, in current_time
> >     1/0
> > ZeroDivisionError: integer division or modulo by zero
>
> > So I am seeing the line number of the error reported.  It's (somewhat
> > annoyingly) not actually in the traceback portion of the page, but it is on
> > the page.  Are you seeing something different?
>
> > Karen
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to