Don't do massive find replace will always get you into problem

This commit is contained in:
Roland Hedberg
2011-03-14 13:25:33 +01:00
parent 89ef48df47
commit 8d8e04b2c9
7 changed files with 25 additions and 14 deletions

View File

@@ -372,7 +372,8 @@ class MetaData(object):
self.import_metadata(content, (url, cert))
return True
else:
self.if log: self.log.info("Response status: %s" % response.status)
if self.log:
self.log.info("Response status: %s" % response.status)
return False
def idp_services(self, entity_id, typ, binding=None):

View File

@@ -52,7 +52,8 @@ class Request(object):
except TypeError:
raise
except Exception, excp:
self.if log: self.log.info("EXCEPTION: %s", excp)
if self.log:
self.log.info("EXCEPTION: %s", excp)
if not self.message:
if self.log:

View File

@@ -153,7 +153,8 @@ class StatusResponse(object):
except SignatureError:
raise
except Exception, excp:
self.if log: self.log.info("EXCEPTION: %s", excp)
if self.log:
self.log.info("EXCEPTION: %s", excp)
print "<", self.response
@@ -321,7 +322,8 @@ class AuthnResponse(StatusResponse):
self.timeslack)
validate_before(condition.not_before, self.timeslack)
except Exception, excp:
self.if log: self.log.error("Exception on condition: %s" % (excp,))
if self.log:
self.log.error("Exception on condition: %s" % (excp,))
if not lax:
raise
else:

View File

@@ -293,9 +293,10 @@ class Server(object):
try:
consumer_url = self.metadata.consumer_url(sp_entity_id)
except KeyError:
self.if log: self.log.info(
if self.log:
self.log.info(
"Failed to find consumer URL for %s" % sp_entity_id)
self.if log: self.log.info(
if self.log: self.log.info(
"entities: %s" % self.metadata.entity.keys())
raise UnknownPrincipal(sp_entity_id)
@@ -603,7 +604,8 @@ class Server(object):
self.log.info("binding wanted: %s" % (binding,))
raise
self.if log: self.log.info("Endpoint: %s" % slo)
if self.log:
self.log.info("Endpoint: %s" % slo)
req = LogoutRequest(self.sec, slo)
if binding == BINDING_SOAP:
lreq = soap.parse_soap_enveloped_saml_logout_request(text)
@@ -651,7 +653,8 @@ class Server(object):
if not destination:
self.if log: self.log.error("Not way to return a response !!!")
if self.log:
self.log.error("Not way to return a response !!!")
return ("412 Precondition Failed",
[("Content-type", "text/html")],
["No return way defined"])
@@ -697,7 +700,8 @@ class Server(object):
to_sign = [(class_name(response), mid)]
response = signed_instance_factory(response, self.sec, to_sign)
self.if log: self.log.info("Response: %s" % (response,))
if self.log:
self.log.info("Response: %s" % (response,))
if binding == BINDING_HTTP_REDIRECT:
(headers, message) = http_redirect_message(response,
destination,

View File

@@ -388,7 +388,8 @@ class SecurityContext(object):
self.debug = 0
def correctly_signed(self, xml, must=False):
self.if log: self.log.info("verify correct signature")
if self.log:
self.log.info("verify correct signature")
return self.correctly_signed_response(xml, must)
def decrypt(self, enctext):
@@ -397,7 +398,8 @@ class SecurityContext(object):
:param enctext: The encrypted text as a string
:return: The decrypted text
"""
self.if log: self.log.info("input len: %d" % len(enctext))
if self.log:
self.log.info("input len: %d" % len(enctext))
_, fil = make_temp("%s" % enctext, decode=False)
ntf = NamedTemporaryFile()

View File

@@ -133,7 +133,8 @@ class SOAPClient(object):
response = self.server.post(soap_message,
{"content-type": "application/soap+xml"})
if response:
self.if log: self.log.info("SOAP response: %s" % response)
if self.log:
self.log.info("SOAP response: %s" % response)
return parse_soap_enveloped_saml_response(response)
else:
return False

View File

@@ -41,8 +41,8 @@ class VirtualOrg(object):
# Remove the ones I have cached data from about this subject
vo_members = [m for m in vo_members if not self.sp.users.cache.active(
subject_id, m)]
self.if log: self.log.info(
"VO members (not cached): %s" % vo_members)
if self.log:
self.log.info("VO members (not cached): %s" % vo_members)
return vo_members
def get_common_identifier(self, subject_id):