set last_updated and date_created as read only fields
[sfa.git] / sfa / util / record.py
index f2a455b..45b77db 100644 (file)
@@ -45,11 +45,12 @@ class GeniRecord(dict):
 
     fields = {
         'authority': Parameter(str, "The authority for this record"),
+        'peer_authority': Parameter(str, "The peer authority for this record"),
         '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'),
-        'date_created': Parameter(int, 'Date and time this record was created'),
+        '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,12 +62,13 @@ class GeniRecord(dict):
     # @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, dict=None, string=None):
+    def __init__(self, hrn=None, gid=None, type=None, pointer=None, peer_authority=None, dict=None, string=None):
         self.dirty = True
         self.hrn = None
         self.gid = None
         self.type = None
         self.pointer = None
+        self.set_peer_auth(peer_authority)
         if hrn:
             self.set_name(hrn)
         if gid:
@@ -150,6 +152,12 @@ class GeniRecord(dict):
         self['pointer'] = pointer
         self.dirty = True
 
+
+    def set_peer_auth(self, peer_authority):
+        self.peer_authority = peer_authority
+        self['peer_authority'] = peer_authority
+        self.dirty = True
+
     ##
     # Return the name (HRN) of the record