Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: LukaszKorzybski |Owner: tobias Type: Bug | Status: closed Component: Database layer | Version: SVN (models, ORM) | Resolution: fixed Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1| Patch needs improvement: 0 Needs tests: 0|UI/UX: 0 Easy pickings: 1| -+- Changes (by kmtracey): * status: assigned => closed * resolution: => fixed Comment: In [17093]: {{{ #!CommitTicketReference repository="" revision="17093" Fixed #13640: Avoid generating an exception when a model has an attribute named 'evaluate'. Thanks LukaszKorzybski and tobias. }}} -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:16> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: LukaszKorzybski |Owner: tobias Type: Bug | Status: assigned Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1| Patch needs improvement: 0 Needs tests: 0|UI/UX: 0 Easy pickings: 1| -+- Comment (by tobias): Sorry about that, it's been so long since I wrote the original patch I honestly had forgotten doing it, and it seemed like a pretty trivial fix to me. I'll make sure I get someone else to review it next time. -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:15> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: LukaszKorzybski |Owner: tobias Type: Bug | Status: assigned Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1| Patch needs improvement: 0 Needs tests: 0|UI/UX: 0 Easy pickings: 1| -+- Changes (by aaugustin): * stage: Ready for checkin => Accepted Comment: You shouldn't mark your own patches as "ready for checkin"; a review by someone else is required. -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:14> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: LukaszKorzybski |Owner: tobias Type: Bug | Status: assigned Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Ready for Keywords: | checkin Has patch: 1| Needs documentation: 0 Needs tests: 0| Patch needs improvement: 0 Easy pickings: 1|UI/UX: 0 -+- Changes (by tobias): * needs_better_patch: 1 => 0 * needs_tests: 1 => 0 -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:13> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: LukaszKorzybski |Owner: tobias Type: Bug | Status: assigned Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Ready for Keywords: | checkin Has patch: 1| Needs documentation: 0 Needs tests: 1| Patch needs improvement: 1 Easy pickings: 1|UI/UX: 0 -+- Changes (by tobias): * stage: Accepted => Ready for checkin -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:12> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: LukaszKorzybski |Owner: tobias Type: Bug | Status: assigned Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1| Patch needs improvement: 1 Needs tests: 1|UI/UX: 0 Easy pickings: 1| -+- Comment (by tobias): Updated patch with test here: https://github.com/django/django/pull/75 And the corresponding diff: https://github.com/django/django/pull/75.diff -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:11> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: | Owner: tobias LukaszKorzybski| Status: assigned Type: Bug| Component: Database layer Milestone: | (models, ORM) Version: SVN| Severity: Normal Resolution: | Keywords: Triage Stage: Accepted | Has patch: 1 Needs documentation: 0 |Needs tests: 1 Patch needs improvement: 1 | Easy pickings: 1 UI/UX: 0 | -+- Changes (by mtredinnick): * needs_better_patch: 0 => 1 * needs_tests: 0 => 1 * stage: Ready for checkin => Accepted Comment: I don't understand the claim that this doesn't need a test. Either it currently works properly, or the change is needed. If the change is needed, it requires a test to ensure we don't break it again in the future. -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:10> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: | Owner: tobias LukaszKorzybski| Status: assigned Type: Bug| Component: Database layer Milestone: | (models, ORM) Version: SVN| Severity: Normal Resolution: | Keywords: Triage Stage: Ready for | Has patch: 1 checkin|Needs tests: 0 Needs documentation: 0 | Easy pickings: 1 Patch needs improvement: 0 | UI/UX: 0 | -+- Changes (by b.leskes@…): * ui_ux: => 0 * has_patch: 0 => 1 * version: 1.2 => SVN * stage: Accepted => Ready for checkin Comment: The bug was verified against trunk and the suggested solution is approved by Alex. I extracted the fix from the original patch and it is ready for checkin to trunk. There is no need to add the test as it tests a functionality that has removed (the hasattr test is not used anymore). -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:9> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: | Owner: tobias LukaszKorzybski| Status: assigned Type: Bug| Component: Database layer Milestone: | (models, ORM) Version: 1.2| Severity: Normal Resolution: | Keywords: Triage Stage: Accepted | Has patch: 0 Needs documentation: 0 |Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 1 -+- Changes (by net147): * easy: 0 => 1 -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:8> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute -+- Reporter: | Owner: tobias LukaszKorzybski| Status: assigned Type: Bug| Component: Database layer Milestone: | (models, ORM) Version: 1.2| Severity: Normal Resolution: | Keywords: Triage Stage: Accepted | Has patch: 0 Needs documentation: 0 |Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 -+- Changes (by net147): * cc: net147 (added) * easy: => 0 -- Ticket URL: <https://code.djangoproject.com/ticket/13640#comment:7> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute ---+ Reporter: LukaszKorzybski | Owner: tobias Status: assigned | Milestone: Component: Database layer (models, ORM) | Version: 1.2 Resolution:| Keywords: Stage: Accepted | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by tobias): I don't know enough about the ORM to know which of these makes the most sense. All tests pass with each patch. -- Ticket URL: <http://code.djangoproject.com/ticket/13640#comment:5> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute ---+ Reporter: LukaszKorzybski | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.2 Resolution:| Keywords: Stage: Unreviewed| Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Old description: > I was migrating some django project recently from django 1.0.4 to 1.2. > In Django 1.2/1.1 I found that if model have 'evaluate' attribute then > one will get exception in admin edit page for that model if the page > contains inline forms with related models: > > Exception Value: 'Shipper' object has no attribute 'prepare' > Exception Location: .../django/db/models/sql/expressions.py in > __init__, line 12 > > It is caused by the fact that add_filter function in django/db/models/ > sql/query.py does such a check: > > ... > 1005. elif hasattr(value, 'evaluate'): > 1006. # If value is a query expression, evaluate it > 1007. value = SQLEvaluator(value, self) ... > 1008. having_clause = value.contains_aggregate > ... > > The problem is that "value" in this case is Shipper model which in > have "evaluate" method so it is recognized as query expression here. > > Greetings, New description: I was migrating some django project recently from django 1.0.4 to 1.2. In Django 1.2/1.1 I found that if model have 'evaluate' attribute then one will get exception in admin edit page for that model if the page contains inline forms with related models: {{{ Exception Value: 'Shipper' object has no attribute 'prepare' Exception Location: .../django/db/models/sql/expressions.py in __init__, line 12 }}} It is caused by the fact that add_filter function in django/db/models/sql/query.py does such a check: {{{ ... 1005. elif hasattr(value, 'evaluate'): 1006. # If value is a query expression, evaluate it 1007. value = SQLEvaluator(value, self) ... 1008. having_clause = value.contains_aggregate ... }}} The problem is that "value" in this case is Shipper model which in have "evaluate" method so it is recognized as query expression here. Greetings, Comment (by Alex): Updated the syntax. -- Ticket URL: <http://code.djangoproject.com/ticket/13640#comment:2> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute ---+ Reporter: LukaszKorzybski | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.2 Resolution:| Keywords: Stage: Unreviewed| Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by LukaszKorzybski): * needs_better_patch: => 0 * needs_tests: => 0 * needs_docs: => 0 Comment: Ups I forgot to do some formatting of the text, sorry for that :/ -- Ticket URL: <http://code.djangoproject.com/ticket/13640#comment:1> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
[Django] #13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute
#13640: add_filter in django/db/models/ sql/query.py causes exception when model have 'evaluate' attribute --+- Reporter: LukaszKorzybski | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.2 Keywords:| Stage: Unreviewed Has_patch: 0 | --+- I was migrating some django project recently from django 1.0.4 to 1.2. In Django 1.2/1.1 I found that if model have 'evaluate' attribute then one will get exception in admin edit page for that model if the page contains inline forms with related models: Exception Value: 'Shipper' object has no attribute 'prepare' Exception Location: .../django/db/models/sql/expressions.py in __init__, line 12 It is caused by the fact that add_filter function in django/db/models/ sql/query.py does such a check: ... 1005. elif hasattr(value, 'evaluate'): 1006. # If value is a query expression, evaluate it 1007. value = SQLEvaluator(value, self) ... 1008. having_clause = value.contains_aggregate ... The problem is that "value" in this case is Shipper model which in have "evaluate" method so it is recognized as query expression here. Greetings, -- Ticket URL: <http://code.djangoproject.com/ticket/13640> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.