diff libervia_server/__init__.py @ 333:c01397d18026

server side: paramsXml2xmlUI is now parasXML2XMLUI + improved lisibility in getParamsUI
author Goffi <goffi@goffi.org>
date Tue, 04 Feb 2014 16:49:20 +0100
parents 06a48d805547
children 629c99bbd031
line wrap: on
line diff
--- a/libervia_server/__init__.py	Tue Feb 04 16:49:20 2014 +0100
+++ b/libervia_server/__init__.py	Tue Feb 04 16:49:20 2014 +0100
@@ -45,6 +45,7 @@
 from libervia_server.blog import MicroBlog
 from sat_frontends.bridge.DBus import DBusBridgeFrontend, BridgeExceptionNoService
 from sat.core.i18n import _, D_
+from sat.tools.xml_tools import paramsXML2XMLUI
 
 
 class ISATSession(Interface):
@@ -446,22 +447,21 @@
         profile = ISATSession(self.session).profile
         d = self.asyncBridgeCall("getParams", Const.SECURITY_LIMIT, Const.APP_NAME, profile)
 
-        def setAuthorizedParams(d):
+        def setAuthorizedParams(params_xml):
             if self.authorized_params is None:
                 self.authorized_params = {}
-                for cat in minidom.parseString(d.encode('utf-8')).getElementsByTagName("category"):
+                for cat in minidom.parseString(params_xml.encode('utf-8')).getElementsByTagName("category"):
                     params = cat.getElementsByTagName("param")
                     params_list = [param.getAttribute("name") for param in params]
                     self.authorized_params[cat.getAttribute("name")] = params_list
             if self.authorized_params:
-                return d
+                return params_xml
             else:
                 return None
 
         d.addCallback(setAuthorizedParams)
 
-        from sat.tools.xml_tools import paramsXml2xmlUI
-        d.addCallback(lambda d: paramsXml2xmlUI(d) if d else "")
+        d.addCallback(lambda params_xml: paramsXML2XMLUI(params_xml) if params_xml else "")
 
         return d