From afe0afdb88727de854de48909e4eb28c1ff57c66 Mon Sep 17 00:00:00 2001 From: Nathan Yergler Date: Mon, 26 Nov 2012 20:24:30 -0800 Subject: [PATCH] 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. --- mediagoblin/db/sql/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mediagoblin/db/sql/base.py b/mediagoblin/db/sql/base.py index e10e7739..ca0c8166 100644 --- a/mediagoblin/db/sql/base.py +++ b/mediagoblin/db/sql/base.py @@ -51,12 +51,18 @@ class GMGTableBase(object): query = Session.query_property() @classmethod - def find(cls, query_dict={}): + def find(cls, query_dict=None): + if query_dict is None: + query_dict = {} + _fix_query_dict(query_dict) return cls.query.filter_by(**query_dict) @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) return cls.query.filter_by(**query_dict).first() -- 2.25.1