aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-09-05 20:43:20 +0000
committerRob Austein <sra@hactrn.net>2009-09-05 20:43:20 +0000
commit9d1c503836dc2d67042cf0509bf0f97c913317d4 (patch)
tree22c810cca5251b6d6dbfbdbb4d3071f5770b0da7
parent0f8bba5acfcbcfde808fb2e46e51abce812cc5d6 (diff)
Simplify serve_pre_save_hook().
svn path=/rpkid/rpki/left_right.py; revision=2740
-rw-r--r--rpkid/rpki/left_right.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py
index 1aaac024..3386a127 100644
--- a/rpkid/rpki/left_right.py
+++ b/rpkid/rpki/left_right.py
@@ -102,25 +102,15 @@ class data_elt(rpki.xml_utils.data_elt, rpki.sql.sql_persistent, left_right_name
self and q_pdu may be the same object; when they are, this is a
create operation, when they're not, this is a set operation and
self is the pre-existing object from sql.
-
- I'm pretty sure that this method could become simpler. I have no
- idea why we care about setting id values in r_pdu, and suspect
- that was just confusion on my part. This version seems to work,
- though, so I'm checking it in before attempting cleanup.
"""
for tag, elt in self.handles:
id_name = tag + "_id"
- if getattr(r_pdu, id_name, None) is not None:
- continue
- val = getattr(self, id_name, None)
- if val is None:
+ if getattr(self, id_name, None) is None:
handle_name = tag + "_handle"
x = elt.serve_fetch_handle(self.gctx, self.self_id, getattr(q_pdu, handle_name))
if x is None:
raise rpki.exceptions.HandleTranslationError, "Could not translate %r %r %r" % (handle_name, self, q_pdu)
- val = getattr(x, id_name)
- setattr(self, id_name, val)
- setattr(r_pdu, id_name, val)
+ setattr(self, id_name, getattr(x, id_name))
cb()
def unimplemented_control(self, *controls):