From 6462e03109be39a7e6e82ba5c49874d4652b5810 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 4 Jul 2009 20:13:22 +0000 Subject: Clean up and consolidate traceback. Add methods to hide (some of the) mucking about with msg.type variables. Include query PDU tags in reply PDUs. svn path=/rpkid/irbe-setup.py; revision=2571 --- rpkid/rpki/xml_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'rpkid/rpki/xml_utils.py') 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 -- cgit v1.2.3