X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Ftrust%2Fcredential.py;fp=sfa%2Ftrust%2Fcredential.py;h=8a6c0bbca3d12d66494eb67339f6124d9bda8c94;hp=92c114e36220f4db5d939afc859a0cbbd619ab73;hb=b18eb6202dbcaccf80d53c533a22f7d4bf733c54;hpb=130e896408741add08ebc3a1b6c74aca11023c1e diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py index 92c114e3..8a6c0bbc 100644 --- a/sfa/trust/credential.py +++ b/sfa/trust/credential.py @@ -286,21 +286,19 @@ class Credential(object): self.version = cred['geni_version'] if string or filename: - if string: - str = string - elif filename: + if not string: with open(filename) as infile: - str = infile.read() + string = infile.read() # if this is a legacy credential, write error and bail out - if isinstance(str, str) and str.strip().startswith("-----"): + if isinstance(string, str) and string.strip().startswith("-----"): logger.error( "Legacy credentials not supported any more " "- giving up with {}..." .format(str[:10])) return else: - self.xml = str + self.xml = string self.decode() # not strictly necessary but won't hurt either self.get_xmlsec1_path()