- use base class __init__() and delete() implementations
[plcapi.git] / PLC / SliceAttributeTypes.py
index e719868..ad8672c 100644 (file)
@@ -13,6 +13,7 @@ class SliceAttributeType(Row):
 
     table_name = 'slice_attribute_types'
     primary_key = 'attribute_type_id'
+    join_tables = ['slice_attribute']
     fields = {
         'attribute_type_id': Parameter(int, "Slice attribute type identifier"),
         'name': Parameter(str, "Slice attribute type name", max = 100),
@@ -20,10 +21,6 @@ class SliceAttributeType(Row):
         'min_role_id': Parameter(int, "Minimum (least powerful) role that can set or change this attribute"),
         }
 
-    def __init__(self, api, fields = {}):
-        Row.__init__(self, fields)
-        self.api = api
-
     def validate_name(self, name):
         name = name.strip()
 
@@ -44,22 +41,6 @@ class SliceAttributeType(Row):
 
         return role_id
 
-    def delete(self, commit = True):
-        """
-        Delete existing slice attribute type.
-        """
-
-        assert 'attribute_type_id' in self
-
-        # Clean up miscellaneous join tables
-        for table in ['slice_attribute_types', 'slice_attribute']:
-            self.api.db.do("DELETE FROM %s" \
-                           " WHERE attribute_type_id = %d" % \
-                           (table, self['attribute_type_id']), self)
-
-        if commit:
-            self.api.db.commit()
-
 class SliceAttributeTypes(Table):
     """
     Representation of row(s) from the slice_attribute_types table in the