Remove duplicate code _find_rhs_lhs_subquery (#190)

This commit is contained in:
Andrew Chen Wang 2021-06-06 14:17:49 -04:00 committed by GitHub
parent c2696398a8
commit 9d528656d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 18 deletions

View file

@ -8,6 +8,7 @@ Whats new in django-cachalot?
and `CACHALOT_UNCACHABLE_APPS` (#187)
- Drop support for Django 3.0 (#189)
- (Internal) Added Django main-branch CI on cron job
- (Internal) Removed duplicate code (#190)
2.4.1
-----

View file

@ -118,24 +118,6 @@ def _find_rhs_lhs_subquery(side):
raise UncachableQuery
def _find_rhs_lhs_subquery(side):
h_class = side.__class__
if h_class is Query:
return side
elif h_class is QuerySet:
return side.query
elif h_class in (Subquery, Exists): # Subquery allows QuerySet & Query
try:
return side.query.query if side.query.__class__ is QuerySet else side.query
except AttributeError: # TODO Remove try/except closure after drop Django 2.2
try:
return side.queryset.query
except AttributeError:
return None
elif h_class in UNCACHABLE_FUNCS:
raise UncachableQuery
def _find_subqueries_in_where(children):
for child in children:
child_class = child.__class__