X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FSliceAttributeTypes.py;h=ad8672c5b1c3ed7712bfb4c835bb4788cf8b2c3e;hb=5dc283f954f5a2b82429aa0c5d5d8c5fc64eefac;hp=e719868994907aed65377f7ef35364dff8153fc7;hpb=b686da7fd3736da867e43e4f957d14c9d98fb4c9;p=plcapi.git diff --git a/PLC/SliceAttributeTypes.py b/PLC/SliceAttributeTypes.py index e719868..ad8672c 100644 --- a/PLC/SliceAttributeTypes.py +++ b/PLC/SliceAttributeTypes.py @@ -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