aboutsummaryrefslogtreecommitdiff
path: root/rpki/publication.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-05-29 19:33:43 +0000
committerRob Austein <sra@hactrn.net>2014-05-29 19:33:43 +0000
commit07a045d1259f30878abba416b86373c05c929965 (patch)
tree9b8e4fe0038e4891e3b262168dce5ecfdccc36f7 /rpki/publication.py
parente6047c9f737275d898d88737719dd09a6ee4f25c (diff)
Python style police: instantiate exceptions before raising them
(convert two-expression form of "raise" to one-expression form). svn path=/trunk/; revision=5844
Diffstat (limited to 'rpki/publication.py')
-rw-r--r--rpki/publication.py18
1 files changed, 9 insertions, 9 deletions
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):