From dfdb845c55eaf58e8ac8954cf8aef90047471a99 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Tue, 21 Oct 2014 13:40:08 +0200 Subject: [PATCH] Simplification. --- cachalot/monkey_patch.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cachalot/monkey_patch.py b/cachalot/monkey_patch.py index 7e0547a..fda83a8 100644 --- a/cachalot/monkey_patch.py +++ b/cachalot/monkey_patch.py @@ -68,12 +68,8 @@ def _patch_orm_read(): @wraps(original) def inner(compiler, *args, **kwargs): if not cachalot_settings.CACHALOT_ENABLED \ - or isinstance(compiler, WRITE_COMPILERS): - return original(compiler, *args, **kwargs) - - query = compiler.query - - if _has_extra_select_or_where(query): + or isinstance(compiler, WRITE_COMPILERS) \ + or _has_extra_select_or_where(compiler.query): return original(compiler, *args, **kwargs) try: