]> git.phdru.name Git - m_librarian.git/commitdiff
Minor refactoring
authorOleg Broytman <phd@phdru.name>
Sun, 29 May 2016 20:56:20 +0000 (23:56 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 29 May 2016 20:56:20 +0000 (23:56 +0300)
m_librarian/search.py

index d431c30d1bc354c4f2b708dc28017631500ace4e..2e761edaf9cbb5b77348dd4828f53b1ac7dfd418 100644 (file)
@@ -19,19 +19,21 @@ def _mk_search_conditions_with_operator(table, case_sensitive, comparison_op,
             _expressions.append(table.q.id == value)
     if case_sensitive:
         for column, value in values.items():
-            if column != 'id':
-                _expressions.append(
-                    getattr(getattr(table.q, column), comparison_op)(value))
+            if column == 'id':
+                continue
+            _expressions.append(
+                getattr(getattr(table.q, column), comparison_op)(value))
         for expr, value in expressions:
             _expressions.append(
                 getattr(expr, comparison_op)(value))
     else:
         for column, value in values.items():
-            if column != 'id':
-                _expressions.append(
-                    getattr(func.lower(
-                        getattr(table.q, column)),
-                        comparison_op)(value.lower()))
+            if column == 'id':
+                continue
+            _expressions.append(
+                getattr(func.lower(
+                    getattr(table.q, column)),
+                    comparison_op)(value.lower()))
         for expr, value in expressions:
             _expressions.append(
                 getattr(func.lower(expr), comparison_op)(value.lower()))