From 652859a7cb1c618a4054ac39c797fe0a292a8e96 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 6 Jan 2012 13:03:55 +0100 Subject: [PATCH] minor cleanup --- sfa/storage/record.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sfa/storage/record.py b/sfa/storage/record.py index 87d4126f..592bc172 100644 --- a/sfa/storage/record.py +++ b/sfa/storage/record.py @@ -32,14 +32,13 @@ class SfaRecord(Row): of different types. """ - table_name = 'sfa' - - primary_key = 'record_id' +# table_name = 'sfa' +# primary_key = 'record_id' ### the wsdl generator assumes this is named 'fields' internal_fields = { - 'record_id': Parameter(int, 'An id that uniquely identifies this record', ro=True), - 'pointer': Parameter(int, 'An id that uniquely identifies this record in an external database ') + 'record_id': Parameter(int, "An id that uniquely identifies this record", ro=True), + 'pointer': Parameter(int, "An id that uniquely identifies this record in an external database") } fields = { @@ -48,8 +47,8 @@ class SfaRecord(Row): 'hrn': Parameter(str, "Human readable name of object"), 'gid': Parameter(str, "GID of the object"), 'type': Parameter(str, "Record type"), - 'last_updated': Parameter(int, 'Date and time of last update', ro=True), - 'date_created': Parameter(int, 'Date and time this record was created', ro=True), + 'last_updated': Parameter(int, "Date and time of last update", ro=True), + 'date_created': Parameter(int, "Date and time this record was created", ro=True), } all_fields = dict(fields.items() + internal_fields.items()) ## @@ -61,7 +60,8 @@ class SfaRecord(Row): # @param pointer is a pointer to a PLC record # @param dict if !=None, then fill in this record from the dictionary - def __init__(self, hrn=None, gid=None, type=None, pointer=None, authority=None, peer_authority=None, dict=None, string=None): + def __init__(self, hrn=None, gid=None, type=None, pointer=None, authority=None, + peer_authority=None, dict=None, string=None): self.dirty = True self.hrn = None self.gid = None @@ -313,9 +313,9 @@ class SfaRecord(Row): """ recorddict = self.as_dict() filteredDict = dict([(key, val) for (key, val) in recorddict.iteritems() if key in self.fields.keys()]) - record = XML('') - record.parse_dict(filteredDict) - str = record.toxml() + xml_record = XML('') + xml_record.parse_dict(filteredDict) + str = xml_record.toxml() return str ## @@ -329,8 +329,8 @@ class SfaRecord(Row): """ #dict = xmlrpclib.loads(str)[0][0] - record = XML(str) - self.load_from_dict(record.todict()) + xml_record = XML(str) + self.load_from_dict(xml_record.todict()) ## # Dump the record to stdout @@ -439,7 +439,6 @@ class NodeRecord(SfaRecord): fields = { 'hostname': Parameter(str, 'This nodes dns name'), 'node_type': Parameter(str, 'Type of node this is'), - 'node_type': Parameter(str, 'Type of node this is'), 'latitude': Parameter(str, 'latitude'), 'longitude': Parameter(str, 'longitude'), } -- 2.45.2