From: Oleg Broytman Date: Sun, 29 May 2016 20:56:20 +0000 (+0300) Subject: Minor refactoring X-Git-Tag: 0.0.9~3 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=4f7f9bd66d87cf5f69d1ea34bb16f171ba18a90b;p=m_librarian.git Minor refactoring --- diff --git a/m_librarian/search.py b/m_librarian/search.py index d431c30..2e761ed 100644 --- a/m_librarian/search.py +++ b/m_librarian/search.py @@ -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()))