X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FSliceAttributeTypes.py;h=5884fe0a11f399d07bf7efd6af69dda669189299;hb=refs%2Fheads%2Fplanetlab-4_0-branch;hp=4fa0ff85ebf20afefd47bb1532acc41071f2ed87;hpb=e347fc823bbba9d88a3fddf07d5c21024dfd1e55;p=plcapi.git diff --git a/PLC/SliceAttributeTypes.py b/PLC/SliceAttributeTypes.py index 4fa0ff8..5884fe0 100644 --- a/PLC/SliceAttributeTypes.py +++ b/PLC/SliceAttributeTypes.py @@ -22,6 +22,11 @@ class SliceAttributeType(Row): 'min_role_id': Parameter(int, "Minimum (least powerful) role that can set or change this attribute"), } + # for Cache + class_key = 'name' + foreign_fields = ['description','min_role_id'] + foreign_xrefs = [] + def validate_name(self, name): if not len(name): raise PLCInvalidArgument, "Slice attribute type name must be set" @@ -59,9 +64,9 @@ class SliceAttributeTypes(Table): ints = filter(lambda x: isinstance(x, (int, long)), attribute_type_filter) strs = filter(lambda x: isinstance(x, StringTypes), attribute_type_filter) attribute_type_filter = Filter(SliceAttributeType.fields, {'attribute_type_id': ints, 'name': strs}) - sql += " AND (%s)" % attribute_type_filter.sql(api, "OR") + sql += " AND (%s) %s" % attribute_type_filter.sql(api, "OR") elif isinstance(attribute_type_filter, dict): attribute_type_filter = Filter(SliceAttributeType.fields, attribute_type_filter) - sql += " AND (%s)" % attribute_type_filter.sql(api, "AND") + sql += " AND (%s) %s" % attribute_type_filter.sql(api, "AND") self.selectall(sql)