fix packaging for f37 (4/n)
[plcapi.git] / PLC / Methods / UpdatePCUType.py
index 597cbcb..c14006c 100644 (file)
@@ -1,11 +1,10 @@
-# $Id#
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.PCUTypes import PCUType, PCUTypes
 from PLC.Auth import Auth
 
-can_update = lambda (field, value): field in \
+can_update = lambda field_value: field_value[0] in \
              ['model', 'name']
 
 class UpdatePCUType(Method):
@@ -18,7 +17,7 @@ class UpdatePCUType(Method):
 
     roles = ['admin']
 
-    pcu_type_fields = dict(filter(can_update, PCUType.fields.items()))
+    pcu_type_fields = dict(list(filter(can_update, list(PCUType.fields.items()))))
 
     accepts = [
         Auth(),
@@ -29,15 +28,15 @@ class UpdatePCUType(Method):
     returns = Parameter(int, '1 if successful')
 
     def call(self, auth, pcu_type_id, pcu_type_fields):
-        pcu_type_fields = dict(filter(can_update, pcu_type_fields.items()))
+        pcu_type_fields = dict(list(filter(can_update, list(pcu_type_fields.items()))))
 
         pcu_types = PCUTypes(self.api, [pcu_type_id])
         if not pcu_types:
-            raise PLCInvalidArgument, "No such pcu type"
+            raise PLCInvalidArgument("No such pcu type")
 
         pcu_type = pcu_types[0]
         pcu_type.update(pcu_type_fields)
         pcu_type.sync()
-       self.event_objects = {'PCUType': [pcu_type['pcu_type_id']]}     
+        self.event_objects = {'PCUType': [pcu_type['pcu_type_id']]}
 
         return 1