diff options
-rw-r--r-- | ca/tests/smoketest.py | 2 | ||||
-rw-r--r-- | rpki/config.py | 2 | ||||
-rw-r--r-- | rpki/csv_utils.py | 4 | ||||
-rw-r--r-- | rpki/gui/app/forms.py | 4 | ||||
-rw-r--r-- | rpki/gui/app/glue.py | 2 | ||||
-rw-r--r-- | rpki/gui/cacheview/forms.py | 6 | ||||
-rw-r--r-- | rpki/http.py | 8 | ||||
-rw-r--r-- | rpki/irdb/zookeeper.py | 14 | ||||
-rw-r--r-- | rpki/left_right.py | 16 | ||||
-rw-r--r-- | rpki/old_irdbd.py | 4 | ||||
-rw-r--r-- | rpki/pubd.py | 4 | ||||
-rw-r--r-- | rpki/publication.py | 18 | ||||
-rw-r--r-- | rpki/rcynic.py | 2 | ||||
-rw-r--r-- | rpki/resource_set.py | 4 | ||||
-rw-r--r-- | rpki/rpkid.py | 10 | ||||
-rw-r--r-- | rpki/sql.py | 6 | ||||
-rw-r--r-- | rpki/sundial.py | 2 | ||||
-rw-r--r-- | rpki/xml_utils.py | 8 |
18 files changed, 58 insertions, 58 deletions
diff --git a/ca/tests/smoketest.py b/ca/tests/smoketest.py index 1f0215f2..bc73f1a5 100644 --- a/ca/tests/smoketest.py +++ b/ca/tests/smoketest.py @@ -1058,7 +1058,7 @@ class allocation(object): signed = signer.communicate(input = b.pkcs10_request.get_PEM()) if not signed[0]: logger.warning(signed[1]) - raise CouldntIssueBSCEECertificate, "Couldn't issue BSC EE certificate" + raise CouldntIssueBSCEECertificate("Couldn't issue BSC EE certificate") s.bsc_ee = rpki.x509.X509(PEM = signed[0]) s.bsc_crl = rpki.x509.CRL(PEM_file = s.name + "-SELF.crl") logger.info("BSC EE cert for %s SKI %s" % (s.name, s.bsc_ee.hSKI())) diff --git a/rpki/config.py b/rpki/config.py index 1b2c3c34..d5f58238 100644 --- a/rpki/config.py +++ b/rpki/config.py @@ -170,7 +170,7 @@ class parser(object): if isinstance(v, str): v = v.lower() if v not in self.cfg._boolean_states: - raise ValueError, "Not a boolean: %s" % v + raise ValueError("Not a boolean: %s" % v) v = self.cfg._boolean_states[v] return v diff --git a/rpki/csv_utils.py b/rpki/csv_utils.py index 47caabdb..e045b9af 100644 --- a/rpki/csv_utils.py +++ b/rpki/csv_utils.py @@ -61,9 +61,9 @@ class csv_reader(object): continue fields = line.split() if self.min_columns is not None and len(fields) < self.min_columns: - raise BadCSVSyntax, "%s:%d: Not enough columns in line %r" % (self.filename, line_number, line) + raise BadCSVSyntax("%s:%d: Not enough columns in line %r" % (self.filename, line_number, line)) if self.columns is not None and len(fields) > self.columns: - raise BadCSVSyntax, "%s:%d: Too many columns in line %r" % (self.filename, line_number, line) + raise BadCSVSyntax("%s:%d: Too many columns in line %r" % (self.filename, line_number, line)) if self.columns is not None and len(fields) < self.columns: fields += tuple(None for i in xrange(self.columns - len(fields))) yield fields diff --git a/rpki/gui/app/forms.py b/rpki/gui/app/forms.py index 20ce4a07..5394a804 100644 --- a/rpki/gui/app/forms.py +++ b/rpki/gui/app/forms.py @@ -257,8 +257,8 @@ class ROARequest(forms.Form): raise forms.ValidationError( 'max prefix length must be greater than or equal to the prefix length') if max_prefixlen > r.min.bits: - raise forms.ValidationError, \ - 'max prefix length (%d) is out of range for IP version (%d)' % (max_prefixlen, r.min.bits) + raise forms.ValidationError( + 'max prefix length (%d) is out of range for IP version (%d)' % (max_prefixlen, r.min.bits)) self.cleaned_data['max_prefixlen'] = str(max_prefixlen) return self.cleaned_data diff --git a/rpki/gui/app/glue.py b/rpki/gui/app/glue.py index b05e8f0d..0bf5f942 100644 --- a/rpki/gui/app/glue.py +++ b/rpki/gui/app/glue.py @@ -102,7 +102,7 @@ def list_received_resources(log, conf): if isinstance(pdu, report_error_elt): # this will cause the db to be rolled back so the above delete() # won't clobber existing resources - raise LeftRightError, pdu + raise LeftRightError(pdu) elif isinstance(pdu, list_received_resources_elt): if pdu.parent_handle != conf.handle: parent = models.Parent.objects.get(issuer=conf, diff --git a/rpki/gui/cacheview/forms.py b/rpki/gui/cacheview/forms.py index 28b8ff24..7ae3601f 100644 --- a/rpki/gui/cacheview/forms.py +++ b/rpki/gui/cacheview/forms.py @@ -30,19 +30,19 @@ class SearchForm(forms.Form): asn = self.cleaned_data.get('asn') addr = self.cleaned_data.get('addr') if (asn and addr) or ((not asn) and (not addr)): - raise forms.ValidationError, 'Please specify either an AS or IP range, not both' + raise forms.ValidationError('Please specify either an AS or IP range, not both') if asn: try: resource_range_as.parse_str(asn) except ValueError: - raise forms.ValidationError, 'invalid AS range' + raise forms.ValidationError('invalid AS range') if addr: #try: parse_ipaddr(addr) #except BadIPResource: - # raise forms.ValidationError, 'invalid IP address range/prefix' + # raise forms.ValidationError('invalid IP address range/prefix') return self.cleaned_data diff --git a/rpki/http.py b/rpki/http.py index 7127bbde..2d53511b 100644 --- a/rpki/http.py +++ b/rpki/http.py @@ -203,7 +203,7 @@ class http_message(object): Parse HTTP version, raise an exception if we can't. """ if version[:5] != "HTTP/": - raise rpki.exceptions.HTTPBadVersion, "Couldn't parse version %s" % version + raise rpki.exceptions.HTTPBadVersion("Couldn't parse version %s" % version) self.version = tuple(int(i) for i in version[5:].split(".")) @property @@ -748,7 +748,7 @@ class http_client(http_stream): assert not self.msg.body self.logger.debug("Ignoring empty response received while closing") return - raise rpki.exceptions.HTTPUnexpectedState, "%r received message while in unexpected state %s" % (self, self.state) + raise rpki.exceptions.HTTPUnexpectedState("%r received message while in unexpected state %s" % (self, self.state)) if self.expect_close: self.logger.debug("Closing") @@ -782,7 +782,7 @@ class http_client(http_stream): if self.get_terminator() is None: self.handle_body() elif self.state == "request-sent": - raise rpki.exceptions.HTTPClientAborted, "HTTP request aborted by close event" + raise rpki.exceptions.HTTPClientAborted("HTTP request aborted by close event") else: self.queue.detach(self) @@ -944,7 +944,7 @@ def client(msg, url, callback, errback): u.params != "" or u.query != "" or u.fragment != ""): - raise rpki.exceptions.BadClientURL, "Unusable URL %s" % url + raise rpki.exceptions.BadClientURL("Unusable URL %s" % url) if debug_http: logger.debug("Contacting %s" % url) diff --git a/rpki/irdb/zookeeper.py b/rpki/irdb/zookeeper.py index f99dc9f0..78783e6b 100644 --- a/rpki/irdb/zookeeper.py +++ b/rpki/irdb/zookeeper.py @@ -150,7 +150,7 @@ def etree_read(filename): if i.tag.startswith(myrpki_namespaceQName): i.tag = i.tag[len(myrpki_namespaceQName):] else: - raise BadXMLMessage, "XML tag %r is not in namespace %r" % (i.tag, myrpki_namespace) + raise BadXMLMessage("XML tag %r is not in namespace %r" % (i.tag, myrpki_namespace)) return e @@ -221,7 +221,7 @@ class Zookeeper(object): self.run_rootd = cfg.getboolean("run_rootd", section = myrpki_section) if self.run_rootd and (not self.run_pubd or not self.run_rpkid): - raise CantRunRootd, "Can't run rootd unless also running rpkid and pubd" + raise CantRunRootd("Can't run rootd unless also running rpkid and pubd") self.default_repository = cfg.get("default_repository", "", section = myrpki_section) self.pubd_contact_info = cfg.get("pubd_contact_info", "", section = myrpki_section) @@ -581,7 +581,7 @@ class Zookeeper(object): else: valid_until = rpki.sundial.datetime.fromXMLtime(valid_until) if valid_until < rpki.sundial.now(): - raise PastExpiration, "Specified new expiration time %s has passed" % valid_until + raise PastExpiration("Specified new expiration time %s has passed" % valid_until) self.log("Child calls itself %r, we call it %r" % (c.get("handle"), child_handle)) @@ -758,7 +758,7 @@ class Zookeeper(object): referral_cms = rpki.x509.SignedReferral(Base64 = auth.text) referral_xml = referral_cms.unwrap(ta = (referrer.certificate, self.server_ca.certificate)) if rpki.x509.X509(Base64 = referral_xml.text) != client_ta: - raise BadXMLMessage, "Referral trust anchor does not match" + raise BadXMLMessage("Referral trust anchor does not match") sia_base = referral_xml.get("authorized_sia_base") except rpki.irdb.Client.DoesNotExist: self.log("We have no record of the client (%s) alleged to have made this referral" % auth.get("referrer")) @@ -788,7 +788,7 @@ class Zookeeper(object): sia_base = "rsync://%s/%s/%s/" % (self.rsync_server, self.rsync_module, client.get("handle")) if not sia_base.startswith("rsync://"): - raise BadXMLMessage, "Malformed sia_base parameter %r, should start with 'rsync://'" % sia_base + raise BadXMLMessage("Malformed sia_base parameter %r, should start with 'rsync://'" % sia_base) client_handle = "/".join(sia_base.rstrip("/").split("/")[4:]) @@ -902,7 +902,7 @@ class Zookeeper(object): else: valid_until = rpki.sundial.datetime.fromXMLtime(valid_until) if valid_until < rpki.sundial.now(): - raise PastExpiration, "Specified new expiration time %s has passed" % valid_until + raise PastExpiration("Specified new expiration time %s has passed" % valid_until) self.log("New validity date %s" % valid_until) @@ -1654,7 +1654,7 @@ class Zookeeper(object): if not valid_until: valid_until = rpki.sundial.now() + rpki.sundial.timedelta(days = 365) elif valid_until < rpki.sundial.now(): - raise PastExpiration, "Specified expiration date %s has already passed" % valid_until + raise PastExpiration("Specified expiration date %s has already passed" % valid_until) pkcs10.check_valid_request_router() diff --git a/rpki/left_right.py b/rpki/left_right.py index ac849915..d85756ce 100644 --- a/rpki/left_right.py +++ b/rpki/left_right.py @@ -129,7 +129,7 @@ class data_elt(rpki.xml_utils.data_elt, rpki.sql.sql_persistent, left_right_name if getattr(self, id_name, None) is None: x = elt.serve_fetch_handle(self.gctx, self.self_id, getattr(q_pdu, tag + "_handle")) if x is None: - raise rpki.exceptions.HandleTranslationError, "Could not translate %r %s_handle" % (self, tag) + raise rpki.exceptions.HandleTranslationError("Could not translate %r %s_handle" % (self, tag)) setattr(self, id_name, getattr(x, id_name)) cb() @@ -562,7 +562,7 @@ class repository_elt(data_elt): logger.debug("Calling pubd handler %r" % handler) handler(r_pdu) if len(q_msg) != len(r_msg): - raise rpki.exceptions.BadPublicationReply, "Wrong number of response PDUs from pubd: sent %r, got %r" % (q_msg, r_msg) + raise rpki.exceptions.BadPublicationReply("Wrong number of response PDUs from pubd: sent %r, got %r" % (q_msg, r_msg)) callback() except (rpki.async.ExitNow, SystemExit): raise @@ -789,10 +789,10 @@ class parent_elt(data_elt): bsc = self.bsc if bsc is None: - raise rpki.exceptions.BSCNotFound, "Could not find BSC %s" % self.bsc_id + raise rpki.exceptions.BSCNotFound("Could not find BSC %s" % self.bsc_id) if bsc.signing_cert is None: - raise rpki.exceptions.BSCNotReady, "BSC %r[%s] is not yet usable" % (bsc.bsc_handle, bsc.bsc_id) + raise rpki.exceptions.BSCNotReady("BSC %r[%s] is not yet usable" % (bsc.bsc_handle, bsc.bsc_id)) q_msg = rpki.up_down.message_pdu.make_query( payload = q_pdu, @@ -911,10 +911,10 @@ class child_elt(data_elt): Fetch the CA corresponding to an up-down class_name. """ if not class_name.isdigit(): - raise rpki.exceptions.BadClassNameSyntax, "Bad class name %s" % class_name + raise rpki.exceptions.BadClassNameSyntax("Bad class name %s" % class_name) ca = rpki.rpkid.ca_obj.sql_fetch(self.gctx, long(class_name)) if ca is None: - raise rpki.exceptions.ClassNameUnknown, "Unknown class name %s" % class_name + raise rpki.exceptions.ClassNameUnknown("Unknown class name %s" % class_name) parent = ca.parent if self.self_id != parent.self_id: raise rpki.exceptions.ClassNameMismatch( @@ -939,7 +939,7 @@ class child_elt(data_elt): bsc = self.bsc if bsc is None: - raise rpki.exceptions.BSCNotFound, "Could not find BSC %s" % self.bsc_id + raise rpki.exceptions.BSCNotFound("Could not find BSC %s" % self.bsc_id) q_cms = rpki.up_down.cms_msg(DER = query) q_msg = q_cms.unwrap((self.gctx.bpki_ta, self.self.bpki_cert, @@ -949,7 +949,7 @@ class child_elt(data_elt): q_cms.check_replay_sql(self, "child", self.child_handle) q_msg.payload.gctx = self.gctx if enforce_strict_up_down_xml_sender and q_msg.sender != self.child_handle: - raise rpki.exceptions.BadSender, "Unexpected XML sender %s" % q_msg.sender + raise rpki.exceptions.BadSender("Unexpected XML sender %s" % q_msg.sender) self.gctx.sql.sweep() def done(r_msg): diff --git a/rpki/old_irdbd.py b/rpki/old_irdbd.py index 8772e5b6..bdeb4f7d 100644 --- a/rpki/old_irdbd.py +++ b/rpki/old_irdbd.py @@ -239,7 +239,7 @@ class main(object): q_msg = rpki.left_right.cms_msg(DER = query).unwrap((self.bpki_ta, self.rpkid_cert)) if not isinstance(q_msg, rpki.left_right.msg) or not q_msg.is_query(): - raise rpki.exceptions.BadQuery, "Unexpected %r PDU" % q_msg + raise rpki.exceptions.BadQuery("Unexpected %r PDU" % q_msg) for q_pdu in q_msg: @@ -248,7 +248,7 @@ class main(object): try: h = self.handle_dispatch[type(q_pdu)] except KeyError: - raise rpki.exceptions.BadQuery, "Unexpected %r PDU" % q_pdu + raise rpki.exceptions.BadQuery("Unexpected %r PDU" % q_pdu) else: h(self, q_pdu, r_msg) diff --git a/rpki/pubd.py b/rpki/pubd.py index e3498a27..8e45aff7 100644 --- a/rpki/pubd.py +++ b/rpki/pubd.py @@ -158,11 +158,11 @@ class main(object): try: match = self.client_url_regexp.search(path) if match is None: - raise rpki.exceptions.BadContactURL, "Bad path: %s" % path + raise rpki.exceptions.BadContactURL("Bad path: %s" % path) client_handle = match.group(1) client = rpki.publication.client_elt.sql_fetch_where1(self, "client_handle = %s", (client_handle,)) if client is None: - raise rpki.exceptions.ClientNotFound, "Could not find client %s" % client_handle + raise rpki.exceptions.ClientNotFound("Could not find client %s" % client_handle) config = rpki.publication.config_elt.fetch(self) if config is None or config.bpki_crl is None: raise rpki.exceptions.CMSCRLNotSet diff --git a/rpki/publication.py b/rpki/publication.py index 0efb0d76..a3278564 100644 --- a/rpki/publication.py +++ b/rpki/publication.py @@ -67,7 +67,7 @@ class control_elt(rpki.xml_utils.data_elt, rpki.sql.sql_persistent, publication_ need to make sure that this PDU arrived via the control channel. """ if self.client is not None: - raise rpki.exceptions.BadQuery, "Control query received on client channel" + raise rpki.exceptions.BadQuery("Control query received on client channel") rpki.xml_utils.data_elt.serve_dispatch(self, r_msg, cb, eb) class config_elt(control_elt): @@ -227,11 +227,11 @@ class publication_object_elt(rpki.xml_utils.base_elt, publication_namespace): # pylint: disable=E0203 try: if self.client is None: - raise rpki.exceptions.BadQuery, "Client query received on control channel" + raise rpki.exceptions.BadQuery("Client query received on control channel") dispatch = { "publish" : self.serve_publish, "withdraw" : self.serve_withdraw } if self.action not in dispatch: - raise rpki.exceptions.BadQuery, "Unexpected query: action %s" % self.action + raise rpki.exceptions.BadQuery("Unexpected query: action %s" % self.action) self.client.check_allowed_uri(self.uri) dispatch[self.action]() r_pdu = self.__class__() @@ -271,7 +271,7 @@ class publication_object_elt(rpki.xml_utils.base_elt, publication_namespace): os.remove(filename) except OSError, e: if e.errno == errno.ENOENT: - raise rpki.exceptions.NoObjectAtURI, "No object published at %s" % self.uri + raise rpki.exceptions.NoObjectAtURI("No object published at %s" % self.uri) else: raise min_path_len = len(self.gctx.publication_base.rstrip("/")) @@ -289,14 +289,14 @@ class publication_object_elt(rpki.xml_utils.base_elt, publication_namespace): Convert a URI to a local filename. """ if not self.uri.startswith("rsync://"): - raise rpki.exceptions.BadURISyntax, self.uri + raise rpki.exceptions.BadURISyntax(self.uri) path = self.uri.split("/")[3:] if not self.gctx.publication_multimodule: del path[0] path.insert(0, self.gctx.publication_base.rstrip("/")) filename = "/".join(path) if "/../" in filename or filename.endswith("/.."): - raise rpki.exceptions.BadURISyntax, filename + raise rpki.exceptions.BadURISyntax(filename) return filename @classmethod @@ -402,9 +402,9 @@ class report_error_elt(rpki.xml_utils.text_elt, publication_namespace): """ t = rpki.exceptions.__dict__.get(self.error_code) if isinstance(t, type) and issubclass(t, rpki.exceptions.RPKI_Exception): - raise t, getattr(self, "text", None) + raise t(getattr(self, "text", None)) else: - raise rpki.exceptions.BadPublicationReply, "Unexpected response from pubd: %s" % self + raise rpki.exceptions.BadPublicationReply("Unexpected response from pubd: %s" % self) class msg(rpki.xml_utils.msg, publication_namespace): """ @@ -425,7 +425,7 @@ class msg(rpki.xml_utils.msg, publication_namespace): Serve one msg PDU. """ if not self.is_query(): - raise rpki.exceptions.BadQuery, "Message type is not query" + raise rpki.exceptions.BadQuery("Message type is not query") r_msg = self.__class__.reply() def loop(iterator, q_pdu): diff --git a/rpki/rcynic.py b/rpki/rcynic.py index 73394fb8..3e8bc085 100644 --- a/rpki/rcynic.py +++ b/rpki/rcynic.py @@ -239,7 +239,7 @@ class rcynic_xml_iterator(object): if uri.startswith(self.base_uri): return uri[len(self.base_uri):] else: - raise NotRsyncURI, "Not an rsync URI %r" % uri + raise NotRsyncURI("Not an rsync URI %r" % uri) def __iter__(self): for validation_status in ElementTree(file=self.xml_file).getroot().getiterator("validation_status"): diff --git a/rpki/resource_set.py b/rpki/resource_set.py index 2ec19cab..8642710e 100644 --- a/rpki/resource_set.py +++ b/rpki/resource_set.py @@ -185,7 +185,7 @@ class resource_range_ip(resource_range): if cls is resource_range_ip and a.version == 6: cls = resource_range_ipv6 return cls.make_prefix(a, int(r.group(2))) - raise rpki.exceptions.BadIPResource, 'Bad IP resource "%s"' % (x) + raise rpki.exceptions.BadIPResource('Bad IP resource "%s"' % x) @classmethod def make_prefix(cls, prefix, prefixlen): @@ -879,7 +879,7 @@ class roa_prefix(object): r = re_prefix.match(x) if r: return cls(rpki.POW.IPAddress(r.group(1)), int(r.group(2))) - raise rpki.exceptions.BadROAPrefix, 'Bad ROA prefix "%s"' % (x) + raise rpki.exceptions.BadROAPrefix('Bad ROA prefix "%s"' % x) class roa_prefix_ipv4(roa_prefix): """ diff --git a/rpki/rpkid.py b/rpki/rpkid.py index 3dc14aac..228e52a1 100644 --- a/rpki/rpkid.py +++ b/rpki/rpkid.py @@ -274,7 +274,7 @@ class main(object): q_msg = q_cms.unwrap((self.bpki_ta, self.irbe_cert)) self.irbe_cms_timestamp = q_cms.check_replay(self.irbe_cms_timestamp, path) if not q_msg.is_query(): - raise rpki.exceptions.BadQuery, "Message type is not query" + raise rpki.exceptions.BadQuery("Message type is not query") q_msg.serve_top_level(self, done) except (rpki.async.ExitNow, SystemExit): raise @@ -296,14 +296,14 @@ class main(object): try: match = self.up_down_url_regexp.search(path) if match is None: - raise rpki.exceptions.BadContactURL, "Bad URL path received in up_down_handler(): %s" % path + raise rpki.exceptions.BadContactURL("Bad URL path received in up_down_handler(): %s" % path) self_handle, child_handle = match.groups() child = rpki.left_right.child_elt.sql_fetch_where1(self, "self.self_handle = %s AND child.child_handle = %s AND child.self_id = self.self_id", (self_handle, child_handle), "self") if child is None: - raise rpki.exceptions.ChildNotFound, "Could not find child %s of self %s in up_down_handler()" % (child_handle, self_handle) + raise rpki.exceptions.ChildNotFound("Could not find child %s of self %s in up_down_handler()" % (child_handle, self_handle)) child.serve_up_down(query, done) except (rpki.async.ExitNow, SystemExit): raise @@ -510,7 +510,7 @@ class ca_obj(rpki.sql.sql_persistent): if not sia_uri or not sia_uri.startswith(parent.sia_base): sia_uri = parent.sia_base if not sia_uri.endswith("/"): - raise rpki.exceptions.BadURISyntax, "SIA URI must end with a slash: %s" % sia_uri + raise rpki.exceptions.BadURISyntax("SIA URI must end with a slash: %s" % sia_uri) # With luck this can go away sometime soon. if self.gctx.merge_publication_directories: return sia_uri @@ -1869,7 +1869,7 @@ class roa_obj(rpki.sql.sql_persistent): logger.debug("Keeping old ca_detail for ROA %r" % self) if ca_detail is None: - raise rpki.exceptions.NoCoveringCertForROA, "Could not find a certificate covering %r" % self + raise rpki.exceptions.NoCoveringCertForROA("Could not find a certificate covering %r" % self) logger.debug("Using new ca_detail %r for ROA %r, ca_detail_state %s" % ( ca_detail, self, ca_detail.state)) diff --git a/rpki/sql.py b/rpki/sql.py index 536ebbe2..adcc78f6 100644 --- a/rpki/sql.py +++ b/rpki/sql.py @@ -226,9 +226,9 @@ class sql_persistent(object): elif len(results) == 1: return results[0] else: - raise rpki.exceptions.DBConsistancyError, \ - "Database contained multiple matches for %s where %s: %r" % \ - (cls.__name__, where % tuple(repr(a) for a in args), results) + raise rpki.exceptions.DBConsistancyError( + "Database contained multiple matches for %s where %s: %r" % + (cls.__name__, where % tuple(repr(a) for a in args), results)) @classmethod def sql_fetch_all(cls, gctx): diff --git a/rpki/sundial.py b/rpki/sundial.py index 0825d61b..1a7b3501 100644 --- a/rpki/sundial.py +++ b/rpki/sundial.py @@ -231,7 +231,7 @@ class timedelta(pydatetime.timedelta): d["seconds"] += d.pop("years") * cls.years_to_seconds return cls(**d) else: - raise ParseFailure, "Couldn't parse timedelta %r" % (arg,) + raise ParseFailure("Couldn't parse timedelta %r" % (arg,)) def convert_to_seconds(self): """ diff --git a/rpki/xml_utils.py b/rpki/xml_utils.py index f254fd11..54cfac6d 100644 --- a/rpki/xml_utils.py +++ b/rpki/xml_utils.py @@ -339,8 +339,8 @@ class data_elt(base_elt): oops = self.serve_fetch_one_maybe() if oops is not None: - raise rpki.exceptions.DuplicateObject, "Object already exists: %r[%r] %r[%r]" % (self, getattr(self, self.element_name + "_handle"), - oops, getattr(oops, oops.element_name + "_handle")) + raise rpki.exceptions.DuplicateObject("Object already exists: %r[%r] %r[%r]" % (self, getattr(self, self.element_name + "_handle"), + oops, getattr(oops, oops.element_name + "_handle"))) self.serve_pre_save_hook(self, r_pdu, one, eb) @@ -412,7 +412,7 @@ class data_elt(base_elt): "list" : self.serve_list, "destroy" : self.serve_destroy } if self.action not in dispatch: - raise rpki.exceptions.BadQuery, "Unexpected query: action %s" % self.action + raise rpki.exceptions.BadQuery("Unexpected query: action %s" % self.action) dispatch[self.action](r_msg, cb, eb) def unimplemented_control(self, *controls): @@ -421,7 +421,7 @@ class data_elt(base_elt): """ unimplemented = [x for x in controls if getattr(self, x, False)] if unimplemented: - raise rpki.exceptions.NotImplementedYet, "Unimplemented control %s" % ", ".join(unimplemented) + raise rpki.exceptions.NotImplementedYet("Unimplemented control %s" % ", ".join(unimplemented)) class msg(list): """ |