Fixed a recursion problem.

Minor editorial changes.
This commit is contained in:
Roland Hedberg
2014-03-11 12:51:32 +01:00
parent 2ff66de237
commit bfa31ef820
5 changed files with 26 additions and 20 deletions

View File

@@ -315,7 +315,6 @@ class Base(Entity):
protocol_binding=binding,
scoping=scoping, **args)
def create_attribute_query(self, destination, name_id=None,
attribute=None, message_id=0, consent=None,
extensions=None, sign=False, sign_prepare=False,

View File

@@ -103,7 +103,8 @@ def repack_cert(cert):
class MetaData(object):
def __init__(self, onts, attrc, metadata="", node_name=None, **kwargs):
def __init__(self, onts, attrc, metadata="", node_name=None,
check_validity=True, **kwargs):
self.onts = onts
self.attrc = attrc
self.entity = {}
@@ -112,6 +113,7 @@ class MetaData(object):
self.node_name = node_name
self.entities_descr = None
self.entity_descr = None
self.check_validity = check_validity
def items(self):
return self.entity.items()
@@ -129,6 +131,7 @@ class MetaData(object):
return self.entity[item]
def do_entity_descriptor(self, entity_descr):
if self.check_validity:
try:
if not valid(entity_descr.valid_until):
logger.info("Entity descriptor (entity id:%s) to old" % (
@@ -187,9 +190,11 @@ class MetaData(object):
logger.error(exc.args[0])
return
if self.check_validity:
try:
if not valid(self.entities_descr.valid_until):
raise ToOld("Metadata not valid anymore, it's after %s" % (
raise ToOld(
"Metadata not valid anymore, it's after %s" % (
self.entities_descr.valid_until,))
except AttributeError:
pass

View File

@@ -451,8 +451,8 @@ class AuthnResponse(StatusResponse):
def __init__(self, sec_context, attribute_converters, entity_id,
return_addrs=None, outstanding_queries=None,
timeslack=0, asynchop=True, allow_unsolicited=False,
test=False, allow_unknown_attributes=False, want_assertions_signed=False,
**kwargs):
test=False, allow_unknown_attributes=False,
want_assertions_signed=False, **kwargs):
StatusResponse.__init__(self, sec_context, return_addrs, timeslack,
asynchop=asynchop)

View File

@@ -248,6 +248,8 @@ def valid_anytype(val):
:return: True is value is valid otherwise an exception is raised
"""
for validator in VALIDATOR.values():
if validator == valid_anytype: # To hinder recursion
continue
try:
if validator(val):
return True