diff options
author | Fredrik Thulin <fredrik@thulin.net> | 2013-09-19 14:41:37 +0200 |
---|---|---|
committer | Fredrik Thulin <fredrik@thulin.net> | 2013-09-19 14:41:37 +0200 |
commit | 5fe5c01aab67400320212545c168984eed0d3657 (patch) | |
tree | 8e4388e8c388b5118ebd155a0bd0abd5bd54a212 /src/saml2/mongo_store.py | |
parent | ecce3c50290380c601e2dbf9d9a0f5695eb648d1 (diff) | |
download | pysaml2-5fe5c01aab67400320212545c168984eed0d3657.tar.gz |
Fix searching for non-primary-key values.
Make sure keyword arguments to get() and remove() are not interpreted
as Value not being None.
Diffstat (limited to 'src/saml2/mongo_store.py')
-rw-r--r-- | src/saml2/mongo_store.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/saml2/mongo_store.py b/src/saml2/mongo_store.py index a3134946..1442da6d 100644 --- a/src/saml2/mongo_store.py +++ b/src/saml2/mongo_store.py @@ -138,7 +138,7 @@ class IdentMDB(IdentDB): self.mdb.primary_key = "user_id" def in_store(self, _id): - if [x for x in self.mdb.get({"ident_id": _id})]: + if [x for x in self.mdb.get(ident_id=id)]: return True else: return False @@ -171,13 +171,13 @@ class IdentMDB(IdentDB): def find_local_id(self, name_id): cnid = to_dict(name_id, ONTS.values(), True) - for item in self.mdb.get({"name_id": cnid}): + for item in self.mdb.get(name_id=cnid): return item[self.mdb.primary_key] return None def remove_remote(self, name_id): cnid = to_dict(name_id, ONTS.values(), True) - self.mdb.remove({"name_id": cnid}) + self.mdb.remove(name_id=cnid) def handle_name_id_mapping_request(self, name_id, name_id_policy): _id = self.find_local_id(name_id) @@ -211,7 +211,7 @@ class MDB(object): _ = self.db.insert(doc) def get(self, value=None, **kwargs): - if value: + if value is not None: doc = {self.primary_key: value} doc.update(kwargs) return [item for item in self.db.find(doc)] |