diff idavoll/backend.py @ 205:e6b710bf2b24

Adjust node configuration to match wokkel API changes. Author: ralphm. Fixes #13.
author Ralph Meijer <ralphm@ik.nu>
date Mon, 04 Aug 2008 07:10:45 +0000
parents 77c61e2b8c75
children 274a45d2a5ab
line wrap: on
line diff
--- a/idavoll/backend.py	Wed Jul 16 06:38:32 2008 +0000
+++ b/idavoll/backend.py	Mon Aug 04 07:10:45 2008 +0000
@@ -268,7 +268,6 @@
 
     def getDefaultConfiguration(self):
         d = defer.succeed(self.defaultConfig)
-        d.addCallback(self._makeConfig)
         return d
 
 
@@ -278,36 +277,13 @@
 
         d = self.storage.getNode(nodeIdentifier)
         d.addCallback(lambda node: node.getConfiguration())
-
-        d.addCallback(self._makeConfig)
         return d
 
 
-    def _makeConfig(self, config):
-        options = []
-        for key, value in self.options.iteritems():
-            option = {"var": key}
-            option.update(value)
-            if config.has_key(key):
-                option["value"] = config[key]
-            options.append(option)
-
-        return options
-
-
     def setNodeConfiguration(self, nodeIdentifier, options, requestor):
         if not nodeIdentifier:
             return defer.fail(error.NoRootNode())
 
-        for key, value in options.iteritems():
-            if not self.options.has_key(key):
-                return defer.fail(error.InvalidConfigurationOption())
-            if self.options[key]["type"] == 'boolean':
-                try:
-                    options[key] = bool(int(value))
-                except ValueError:
-                    return defer.fail(error.InvalidConfigurationValue())
-
         d = self.storage.getNode(nodeIdentifier)
         d.addCallback(_getAffiliation, requestor)
         d.addCallback(self._doSetNodeConfiguration, options)
@@ -609,6 +585,10 @@
         return d.addErrback(self._mapErrors)
 
 
+    def getConfigurationOptions(self):
+        return self.backend.options
+
+
     def getDefaultConfiguration(self, requestor, service):
         d = self.backend.getDefaultConfiguration()
         return d.addErrback(self._mapErrors)