On Wednesday 29 August 2007 13:40:44 George Vilches wrote:
> I looked at the possibility of both of those fixes, and they seem
> doable, but they would require adding special handler code just for
> QuerySets (especially the one to get the SQL generated code instead
> of the QuerySet). I think I agree with your ham-handed phrase there.
>
> That having been said, would a fix like that even get into Django?
> Doesn't sound very Django-ish. I'll do the work, but I'm really
> hoping someone can point me in the direction of what a proper Django
> solution is, I would highly prefer not to have to keep patching this
> with an ugly QuerySet workaround that won't get accepted into trunk.
A nicer alternative would be to have the debugging code
use 'debug_repr()' instead of 'repr()', where:
def debug_repr(obj):
m = getattr(obj, '__debug_repr__', None)
if m is None:
return repr(obj)
else:
return m()
Then you just have to implement __debug_repr__() for QuerySets and any
other objects that have expensive repr()s. This is pretty simple and
elegant AFAICS.
Luke
--
"Adversity: That which does not kill me only postpones the inevitable."
(despair.com)
Luke Plant || http://lukeplant.me.uk/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---