summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/saml2/cache.py8
-rw-r--r--src/saml2/mcache.py10
-rw-r--r--src/saml2/mdbcache.py10
-rw-r--r--src/saml2/mdstore.py6
4 files changed, 21 insertions, 13 deletions
diff --git a/src/saml2/cache.py b/src/saml2/cache.py
index e01349ef..c93a160a 100644
--- a/src/saml2/cache.py
+++ b/src/saml2/cache.py
@@ -17,6 +17,10 @@ class ToOld(SAMLError):
pass
+class TooOld(ToOld):
+ pass
+
+
class CacheError(SAMLError):
pass
@@ -67,7 +71,7 @@ class Cache(object):
for entity_id in entities:
try:
info = self.get(name_id, entity_id, check_not_on_or_after)
- except ToOld:
+ except TooOld:
oldees.append(entity_id)
continue
@@ -98,7 +102,7 @@ class Cache(object):
(timestamp, info) = self._db[cni][entity_id]
info = info.copy()
if check_not_on_or_after and time_util.after(timestamp):
- raise ToOld("past %s" % str(timestamp))
+ raise TooOld("past %s" % str(timestamp))
if 'name_id' in info and isinstance(info['name_id'], six.string_types):
info['name_id'] = decode(info['name_id'])
diff --git a/src/saml2/mcache.py b/src/saml2/mcache.py
index 0ead465f..ceace34d 100644
--- a/src/saml2/mcache.py
+++ b/src/saml2/mcache.py
@@ -3,7 +3,7 @@ import logging
import memcache
from saml2 import time_util
-from saml2.cache import ToOld, CacheError
+from saml2.cache import TooOld, CacheError
# The assumption is that any subject may consist of data
# gathered from several different sources, all with their own
@@ -56,7 +56,7 @@ class Cache(object):
subject_id+'_').items():
try:
info = self.get_info(item)
- except ToOld:
+ except TooOld:
oldees.append(entity_id)
continue
for key, vals in info["ava"].items():
@@ -77,10 +77,10 @@ class Cache(object):
try:
(timestamp, info) = item
except ValueError:
- raise ToOld()
+ raise TooOld()
if check_not_on_or_after and not time_util.not_on_or_after(timestamp):
- raise ToOld()
+ raise TooOld()
return info or None
@@ -170,7 +170,7 @@ class Cache(object):
try:
return time_util.not_on_or_after(timestamp)
- except ToOld:
+ except TooOld:
return False
def subjects(self):
diff --git a/src/saml2/mdbcache.py b/src/saml2/mdbcache.py
index 0d803227..16f6ca07 100644
--- a/src/saml2/mdbcache.py
+++ b/src/saml2/mdbcache.py
@@ -9,7 +9,7 @@ import time
from datetime import datetime
from saml2 import time_util
-from saml2.cache import ToOld
+from saml2.cache import TooOld
from saml2.time_util import TIME_FORMAT
logger = logging.getLogger(__name__)
@@ -51,7 +51,7 @@ class Cache(object):
for item in self._cache.find({"subject_id": subject_id}):
try:
info = self._get_info(item, check_not_on_or_after)
- except ToOld:
+ except TooOld:
oldees.append(item["entity_id"])
continue
@@ -66,7 +66,7 @@ class Cache(object):
try:
info = self.get(subject_id, entity_id,
check_not_on_or_after)
- except ToOld:
+ except TooOld:
oldees.append(entity_id)
continue
@@ -89,7 +89,7 @@ class Cache(object):
timestamp = item["timestamp"]
if check_not_on_or_after and not time_util.not_on_or_after(timestamp):
- raise ToOld()
+ raise TooOld()
try:
return item["info"]
@@ -168,7 +168,7 @@ class Cache(object):
"entity_id": entity_id})
try:
return time_util.not_on_or_after(item["timestamp"])
- except ToOld:
+ except TooOld:
return False
def subjects(self):
diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py
index 82bfa138..36891abb 100644
--- a/src/saml2/mdstore.py
+++ b/src/saml2/mdstore.py
@@ -99,6 +99,10 @@ class ToOld(Exception):
pass
+class TooOld(ToOld):
+ pass
+
+
class SourceNotFound(Exception):
pass
@@ -561,7 +565,7 @@ class InMemoryMetaData(MetaData):
if self.check_validity:
try:
if not valid(self.entities_descr.valid_until):
- raise ToOld(
+ raise TooOld(
"Metadata not valid anymore, it's only valid "
"until %s" % (
self.entities_descr.valid_until,))