From 467e7a98fea439040bd7451d67f188d334427103 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 4 Jun 2009 18:30:40 +0000 Subject: Rototill left-right and publication protocol to replace SQL-assigned numeric identifiers with IRBE-assigned "handles". Daemons and test harness have been converted and seem to work; some tools like irbe_cli haven't been updated yet. svn path=/rpkid/doc/Installation; revision=2493 --- rpkid/rpki/xml_utils.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'rpkid/rpki/xml_utils.py') diff --git a/rpkid/rpki/xml_utils.py b/rpkid/rpki/xml_utils.py index 917405f0..be2b9510 100644 --- a/rpkid/rpki/xml_utils.py +++ b/rpkid/rpki/xml_utils.py @@ -255,7 +255,8 @@ class data_elt(base_elt): if r_pdu is None: r_pdu = self.__class__() self.make_reply_clone_hook(r_pdu) - setattr(r_pdu, self.sql_template.index, getattr(self, self.sql_template.index)) + handle_name = self.element_name + "_handle" + setattr(r_pdu, handle_name, getattr(self, handle_name, None)) else: for b in r_pdu.booleans: setattr(r_pdu, b, False) @@ -267,6 +268,16 @@ class data_elt(base_elt): """Overridable hook.""" pass + def serve_fetch_one(self): + """ + Find the object on which a get, set, or destroy method should + operate. + """ + r = self.serve_fetch_one_maybe() + if r is None: + raise rpki.exceptions.NotFound + return r + def serve_pre_save_hook(self, q_pdu, r_pdu, cb, eb): """Overridable hook.""" cb() @@ -291,6 +302,9 @@ class data_elt(base_elt): r_msg.append(r_pdu) cb() + if self.serve_fetch_one_maybe() is not None: + raise rpki.exceptions.DuplicateObject + self.serve_pre_save_hook(self, r_pdu, one, eb) def serve_set(self, r_msg, cb, eb): -- cgit v1.2.3