From: Tony Mack Date: Thu, 17 Jan 2013 19:58:35 +0000 (-0500) Subject: check xrns arg at beginning of method X-Git-Tag: sfa-3.0-0~23 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=992c6c9487c5ef2b554d11c8e345158908646a94;p=sfa.git check xrns arg at beginning of method --- diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index da7e91fe..4eedb09d 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -36,6 +36,13 @@ class Auth: self.trusted_cert_file_list = TrustedRoots(self.config.get_trustedroots_dir()).get_file_list() def checkCredentials(self, creds, operation, xrns=[], check_sliver_callback=None): + # if xrns are specified they cannot be None or empty string + if xrns: + for xrn in xrns: + if not xrn: + raise BadArgs("Invalid urn or hrn: %s" % hrn) + + if not isinstance(xrns, list): xrns = [xrns] @@ -54,10 +61,6 @@ class Auth: if not hrns: hrns = [None] for cred in creds: for hrn in hrns: - # if an hrn is specified it cannot be None or empty string - if not hrn: - raise BadArgs("Invalid urn or hrn: %s" % hrn) - try: self.check(cred, operation, hrn) valid.append(cred)