Removed calls to deprecated QAnd and QOr from QLeftOuterJoins
Updated 5 months ago
| Mat Schaffer | Reviewers | ||
| reviewboard | |||
| None | Navi | ||
These were deprecated in django r8191 per django #7830 (http://code.djangoproject.com/ticket/7830)
Not sure if djblets has unit tests or how to run them.
Diff revision 1 (Latest)
- /trunk/djblets/djblets/util/db.py: 3 changes [ 1 2 3 ]
| /trunk/djblets/djblets/util/db.py | |||
|---|---|---|---|
| Revision 11813 | New Change | ||
| ... | 22 lines hidden [Expand] | ||
| 23 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
23 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | # |
24 | # |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | from django.db import models, IntegrityError |
27 | from django.db import models, IntegrityError |
| 28 | from django.db.models.query import Q, QAnd, QOr |
28 | from django.db.models.query import Q |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | # |
31 | # |
| 32 | # This is a hack to work around the stupid default behavior of Q objects and OR |
32 | # This is a hack to work around the stupid default behavior of Q objects and OR |
| 33 | # operators. By default, querying (Q(x) | Q(y)) | Q(z) when foreign keys are |
33 | # operators. By default, querying (Q(x) | Q(y)) | Q(z) when foreign keys are |
| ... | 8 lines hidden [Expand] | ||
| 42 | "Replaces all INNER JOINs with LEFT OUTER JOINs inside" |
42 | "Replaces all INNER JOINs with LEFT OUTER JOINs inside" |
| 43 | def __init__(self, q): |
43 | def __init__(self, q): |
| 44 | self.q = q |
44 | self.q = q |
| 45 | 45 | ||
| 46 | def __and__(self, other): |
46 | def __and__(self, other): |
| 47 | return QAnd(self, other) |
47 | return self & other |
| 48 | 48 | ||
| 49 | def __or__(self, other): |
49 | def __or__(self, other): |
| 50 | return QOr(self, other) |
50 | return self | other |
| 51 | 51 | ||
| 52 | def get_sql(self, opts): |
52 | def get_sql(self, opts): |
| 53 | joins, where, params = self.q.get_sql(opts) |
53 | joins, where, params = self.q.get_sql(opts) |
| 54 | for join_name, join in joins.iteritems(): |
54 | for join_name, join in joins.iteritems(): |
| 55 | joins[join_name] = (join[0], "LEFT OUTER JOIN", join[2]) |
55 | joins[join_name] = (join[0], "LEFT OUTER JOIN", join[2]) |
| ... | 25 lines hidden [Expand] | ||
- /trunk/djblets/djblets/util/db.py: 3 changes [ 1 2 3 ]
Other reviews