Skip to content

Commit da8b98c

Browse files
committed
Fix exception name typo
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent b727e21 commit da8b98c

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

src/saml2/cache.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class ToOld(SAMLError):
1717
pass
1818

1919

20+
class TooOld(ToOld):
21+
pass
22+
23+
2024
class CacheError(SAMLError):
2125
pass
2226

@@ -67,7 +71,7 @@ def get_identity(self, name_id, entities=None,
6771
for entity_id in entities:
6872
try:
6973
info = self.get(name_id, entity_id, check_not_on_or_after)
70-
except ToOld:
74+
except TooOld:
7175
oldees.append(entity_id)
7276
continue
7377

@@ -98,7 +102,7 @@ def get(self, name_id, entity_id, check_not_on_or_after=True):
98102
(timestamp, info) = self._db[cni][entity_id]
99103
info = info.copy()
100104
if check_not_on_or_after and time_util.after(timestamp):
101-
raise ToOld("past %s" % str(timestamp))
105+
raise TooOld("past %s" % str(timestamp))
102106

103107
if 'name_id' in info and isinstance(info['name_id'], six.string_types):
104108
info['name_id'] = decode(info['name_id'])

src/saml2/mcache.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import memcache
55
from saml2 import time_util
6-
from saml2.cache import ToOld, CacheError
6+
from saml2.cache import TooOld, CacheError
77

88
# The assumption is that any subject may consist of data
99
# gathered from several different sources, all with their own
@@ -56,7 +56,7 @@ def get_identity(self, subject_id, entities=None):
5656
subject_id+'_').items():
5757
try:
5858
info = self.get_info(item)
59-
except ToOld:
59+
except TooOld:
6060
oldees.append(entity_id)
6161
continue
6262
for key, vals in info["ava"].items():
@@ -77,10 +77,10 @@ def get_info(self, item, check_not_on_or_after=True):
7777
try:
7878
(timestamp, info) = item
7979
except ValueError:
80-
raise ToOld()
80+
raise TooOld()
8181

8282
if check_not_on_or_after and not time_util.not_on_or_after(timestamp):
83-
raise ToOld()
83+
raise TooOld()
8484

8585
return info or None
8686

@@ -170,7 +170,7 @@ def active(self, subject_id, entity_id):
170170

171171
try:
172172
return time_util.not_on_or_after(timestamp)
173-
except ToOld:
173+
except TooOld:
174174
return False
175175

176176
def subjects(self):

src/saml2/mdbcache.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from datetime import datetime
1010

1111
from saml2 import time_util
12-
from saml2.cache import ToOld
12+
from saml2.cache import TooOld
1313
from saml2.time_util import TIME_FORMAT
1414

1515
logger = logging.getLogger(__name__)
@@ -51,7 +51,7 @@ def get_identity(self, subject_id, entities=None,
5151
for item in self._cache.find({"subject_id": subject_id}):
5252
try:
5353
info = self._get_info(item, check_not_on_or_after)
54-
except ToOld:
54+
except TooOld:
5555
oldees.append(item["entity_id"])
5656
continue
5757

@@ -66,7 +66,7 @@ def get_identity(self, subject_id, entities=None,
6666
try:
6767
info = self.get(subject_id, entity_id,
6868
check_not_on_or_after)
69-
except ToOld:
69+
except TooOld:
7070
oldees.append(entity_id)
7171
continue
7272

@@ -89,7 +89,7 @@ def _get_info(self, item, check_not_on_or_after=True):
8989
timestamp = item["timestamp"]
9090

9191
if check_not_on_or_after and not time_util.not_on_or_after(timestamp):
92-
raise ToOld()
92+
raise TooOld()
9393

9494
try:
9595
return item["info"]
@@ -168,7 +168,7 @@ def active(self, subject_id, entity_id):
168168
"entity_id": entity_id})
169169
try:
170170
return time_util.not_on_or_after(item["timestamp"])
171-
except ToOld:
171+
except TooOld:
172172
return False
173173

174174
def subjects(self):

src/saml2/mdstore.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ class ToOld(Exception):
9999
pass
100100

101101

102+
class TooOld(ToOld):
103+
pass
104+
105+
102106
class SourceNotFound(Exception):
103107
pass
104108

@@ -561,7 +565,7 @@ def parse(self, xmlstr):
561565
if self.check_validity:
562566
try:
563567
if not valid(self.entities_descr.valid_until):
564-
raise ToOld(
568+
raise TooOld(
565569
"Metadata not valid anymore, it's only valid "
566570
"until %s" % (
567571
self.entities_descr.valid_until,))

0 commit comments

Comments
 (0)