more ocaml for plc is a good thing, but not in Python code ;)
[plcapi.git] / PLC / Methods / AddKeyType.py
index 86c2bc9..97c69b8 100644 (file)
@@ -1,8 +1,10 @@
+# $Id$
+# $URL$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.KeyTypes import KeyType, KeyTypes
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
 
 class AddKeyType(Method):
     """
@@ -14,15 +16,16 @@ class AddKeyType(Method):
     roles = ['admin']
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         KeyType.fields['key_type']
         ]
 
     returns = Parameter(int, '1 if successful')
 
+
     def call(self, auth, name):
         key_type = KeyType(self.api)
         key_type['key_type'] = name
-        key_type.sync()
+        key_type.sync(insert = True)
 
         return 1