@@ -152,8 +152,8 @@ def prep_value(k, v):
152152 return f'{ k } ="{ v } "'
153153 return f"{ k } ={ v } "
154154
155- def join_conditions (negate , restrictions , operator = "AND" ):
156- return ("NOT (%s) " if negate else "%s" ) % (
155+ def combine_conditions (negate , restrictions , operator = "AND" ):
156+ return ("NOT %s " if negate else "%s" ) % (
157157 f"({ f') { operator } (' .join (restrictions )} )"
158158 )
159159
@@ -165,7 +165,7 @@ def join_conditions(negate, restrictions, operator="AND"):
165165 # restrict by string
166166 if isinstance (condition , str ):
167167 columns .update (extract_column_names (condition ))
168- return join_conditions (
168+ return combine_conditions (
169169 negate , restrictions = [condition .strip ().replace ("%" , "%%" )]
170170 ) # escape %, see issue #376
171171
@@ -183,7 +183,7 @@ def join_conditions(negate, restrictions, operator="AND"):
183183 return negate # if any item is False, the whole thing is False
184184 if not items :
185185 return not negate # and empty AndList is True
186- return join_conditions (negate , restrictions = items )
186+ return combine_conditions (negate , restrictions = items )
187187
188188 # restriction by dj.U evaluates to True
189189 if isinstance (condition , U ):
@@ -201,7 +201,7 @@ def join_conditions(negate, restrictions, operator="AND"):
201201 if not common_attributes :
202202 return not negate # no matching attributes -> evaluates to True
203203 columns .update (common_attributes )
204- return join_conditions (
204+ return combine_conditions (
205205 negate ,
206206 restrictions = [
207207 prep_value (k , v )
@@ -218,7 +218,7 @@ def join_conditions(negate, restrictions, operator="AND"):
218218 if not common_attributes :
219219 return not negate # no matching attributes -> evaluate to True
220220 columns .update (common_attributes )
221- return join_conditions (
221+ return combine_conditions (
222222 negate ,
223223 restrictions = [prep_value (k , condition [k ]) for k in common_attributes ],
224224 )
@@ -269,7 +269,7 @@ def join_conditions(negate, restrictions, operator="AND"):
269269 if any (item is True for item in or_list ): # if any item is True, entirely True
270270 return not negate
271271 return (
272- join_conditions (negate , restrictions = or_list , operator = "OR" )
272+ combine_conditions (negate , restrictions = or_list , operator = "OR" )
273273 if or_list
274274 else negate
275275 )
0 commit comments