From c2703da8f16087a6cc230a0610243de08c794838 Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Mon, 14 Mar 2011 21:51:55 +0100 Subject: [PATCH] support for cases when you don't care whether the session has timedout or not --- src/saml2/mcache.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/saml2/mcache.py b/src/saml2/mcache.py index 48dcc8f..b057a64 100644 --- a/src/saml2/mcache.py +++ b/src/saml2/mcache.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import memcache -import time from saml2 import time_util # The assumption is that any subject may consist of data @@ -63,7 +62,7 @@ class Cache(object): res[key] = vals return res, oldees - def get_info(self, item): + def get_info(self, item, check_not_on_or_after=True): """ Get session information about a subject gotten from a specified IdP/AA. @@ -75,12 +74,12 @@ class Cache(object): except ValueError: raise ToOld() - if info and time_util.not_on_or_after(timestamp): - return info - else: + if check_not_on_or_after and not time_util.not_on_or_after(timestamp): raise ToOld() - def get(self, subject_id, entity_id): + return info or None + + def get(self, subject_id, entity_id, check_not_on_or_after=True): res = self._cache.get(_key(subject_id, entity_id)) if not res: return {}