aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/xml_utils.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-07-04 20:13:22 +0000
committerRob Austein <sra@hactrn.net>2009-07-04 20:13:22 +0000
commit6462e03109be39a7e6e82ba5c49874d4652b5810 (patch)
treea1154f496b34145a4ac0797505f6619727af3fb2 /rpkid/rpki/xml_utils.py
parent6baa092a44b6ae9d1ffddc8fc6928c9bbb368124 (diff)
Clean up and consolidate traceback. Add methods to hide (some of the)
mucking about with msg.type variables. Include query PDU tags in reply <report_error/> PDUs. svn path=/rpkid/irbe-setup.py; revision=2571
Diffstat (limited to 'rpkid/rpki/xml_utils.py')
-rw-r--r--rpkid/rpki/xml_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/rpkid/rpki/xml_utils.py b/rpkid/rpki/xml_utils.py
index be2b9510..9e4aa265 100644
--- a/rpkid/rpki/xml_utils.py
+++ b/rpkid/rpki/xml_utils.py
@@ -415,3 +415,17 @@ class msg(list):
elt = lxml.etree.Element("{%s}msg" % (self.xmlns), nsmap = self.nsmap, version = str(self.version), type = self.type)
elt.extend([i.toXML() for i in self])
return elt
+
+ @classmethod
+ def query(cls, *args):
+ """Create a query PDU."""
+ self = cls(*args)
+ self.type = "query"
+ return self
+
+ @classmethod
+ def reply(cls, *args):
+ """Create a reply PDU."""
+ self = cls(*args)
+ self.type = "reply"
+ return self