Cache:
[plcapi.git] / PLC / Slices.py
index e8f64cc..5e2b2e2 100644 (file)
@@ -39,13 +39,16 @@ class Slice(Row):
         }
     # for Cache
     class_key = 'name'
-    foreign_fields = ['instantiation', 'url', 'description', 'max_nodes', 'created', 'expires']
+    foreign_fields = ['instantiation', 'url', 'description', 'max_nodes', 'expires']
     foreign_xrefs = [
         {'field': 'node_ids' ,         'class': 'Node',   'table': 'slice_node' },
        {'field': 'person_ids',        'class': 'Person', 'table': 'slice_person'},
        {'field': 'creator_person_id', 'class': 'Person', 'table': 'unused-on-direct-refs'},
         {'field': 'site_id',           'class': 'Site',   'table': 'unused-on-direct-refs'},
     ]
+    # forget about this one, it is read-only anyway
+    # handling it causes Cache to re-sync all over again 
+    # 'created'
 
     def validate_name(self, name):
         # N.B.: Responsibility of the caller to ensure that login_base
@@ -75,13 +78,14 @@ class Slice(Row):
 
         return instantiation
 
+    # timestamps
+    def validate_created (self, timestamp):
+       return self.validate_timestamp (timestamp)
+
     def validate_expires(self, expires):
         # N.B.: Responsibility of the caller to ensure that expires is
         # not too far into the future.
-        if expires < time.time():
-            raise PLCInvalidArgument, "Expiration date must be in the future"
-
-        return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(expires))
+       return self.validate_timestamp (expires,True)
 
     def add_person(self, person, commit = True):
         """