add backward compatible SliceGetTicket and SliceTicketGet functions for Emulab during...
[plcapi.git] / PLC / Slices.py
index af6062d..a41e88d 100644 (file)
@@ -58,10 +58,10 @@ class Slice(Row):
         # desired.
 
         # 1. Lowercase.
-        # 2. Begins with login_base (only letters).
+        # 2. Begins with login_base (letters or numbers).
         # 3. Then single underscore after login_base.
         # 4. Then letters, numbers, or underscores.
-        good_name = r'^[a-z]+_[a-z0-9_]+$'
+        good_name = r'^[a-z0-9]+_[a-z0-9_]+$'
         if not name or \
            not re.match(good_name, name):
             raise PLCInvalidArgument, "Invalid slice name"
@@ -85,7 +85,8 @@ class Slice(Row):
     def validate_expires(self, expires):
         # N.B.: Responsibility of the caller to ensure that expires is
         # not too far into the future.
-       return Row.validate_timestamp(self, expires, check_future = True)
+        check_future = not ('is_deleted' in self and self['is_deleted'])
+        return Row.validate_timestamp(self, expires, check_future = check_future)
 
     add_person = Row.add_object(Person, 'slice_person')
     remove_person = Row.remove_object(Person, 'slice_person')