#20393: django.db.models.query.QuerySet.__repr__ should not have side-effects
-------------------------------------+-------------------------------------
     Reporter:  justin@…             |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:  wontfix
     Severity:  Normal               |             Triage Stage:
     Keywords:  QuerySet, repr,      |  Unreviewed
  side-effect                        |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by lukeplant):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 Well, you can argue that semantically these methods don't have side
 effects. They do 'SELECT', not 'UPDATE'. They do happen to use IO, and can
 therefore fail in all kinds of ways. "SELECT FOR UPDATE" is an unfortunate
 edge case.

 Looking at these docs:

 [http://docs.python.org/2/reference/datamodel.html#object.__repr__]

 ... you have a conflict between the goal of being information rich and
 with **always** being useful for debugging. In general, automatically
 seeing the results is information rich and is useful in debugging, but
 sometimes it causes further problems.

 I have thought about it, and with this conflict of goals, I think we are
 going to have to err on the side of the current behaviour. It is possible
 to work around by not calling `repr` on `QuerySets` in your middleware,
 and there are too many people who will be upset (or have problems with
 their own debugging facilities) by changing this.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20393#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to