implement DeleteRole()
[plcapi.git] / PLC / NovaObject.py
index 8a20927..382d69f 100644 (file)
@@ -1,12 +1,19 @@
 class NovaObject:
 
-    # Set this to a dict of the valid fields of this object and their
-    # types. Not all fields (e.g., joined fields) may be updated via
-    # sync().
-    @staticmethod 
+    @staticmethod
     def object_to_dict(object, fields):
         d = {}
         for field in fields:
             if hasattr(object, field):
                 d[field] = getattr(object, field)
-        return d    
+        return d   
+
+
+class NovaObjects(list):
+    fields = {}
+
+    def dicts(self):
+        result = []
+        for obj in self:
+            result.append(NovaObject.object_to_dict(obj, self.fields))
+        return result