Ensure query_dict is a dict after the contents have been modified.
_fix_query_dict modifies its argument in place. Ensure that the argument passed in has a local name and will be passed into the subsequent filter_by call.
This commit is contained in:
parent
41fc4698c5
commit
afe0afdb88
@ -51,12 +51,18 @@ class GMGTableBase(object):
|
|||||||
query = Session.query_property()
|
query = Session.query_property()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find(cls, query_dict={}):
|
def find(cls, query_dict=None):
|
||||||
|
if query_dict is None:
|
||||||
|
query_dict = {}
|
||||||
|
|
||||||
_fix_query_dict(query_dict)
|
_fix_query_dict(query_dict)
|
||||||
return cls.query.filter_by(**query_dict)
|
return cls.query.filter_by(**query_dict)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_one(cls, query_dict={}):
|
def find_one(cls, query_dict=None):
|
||||||
|
if query_dict is None:
|
||||||
|
query_dict = {}
|
||||||
|
|
||||||
_fix_query_dict(query_dict)
|
_fix_query_dict(query_dict)
|
||||||
return cls.query.filter_by(**query_dict).first()
|
return cls.query.filter_by(**query_dict).first()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user