﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1490	if __repr__ returns an int, {% debug %} gets an exception	gt-django@…	Adrian Holovaty	"(note: Russ Magee said to submit this as an enhancement... I think it's more of a bug, but... ok)

As part of developing my first Django app I'd make use of {% debug %}
often to see what's happening.  I spent a while yesterday trying to
figure out why, just inserting a debug line in my template caused a
traceback of a rendering exception.

Turns out that I mistakenly had created a class with a __repr__ that
returned a integer field instead of a ""str"".  When I changed it to
""return str(self.value)"" debug again worked fine.

I don't know if I'd call this a bug or not, but... I sure wish that
using a debug wouldn't protect itself from exceptions...

Yes, the docs do say:

   Thus, you should always return a nice, human-readable string for
   the object's __repr__.

I just don't think that debug should barf if an oject's
__repr__ doesn't return a string.


I think that at the least, something like DEBUG should fail silently...

thanks

"	defect	closed	Template system		normal	invalid			Design decision needed	0	0	0	0	0	0
