diff src/tools/xml_tools.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents ca13633d3b6b
children beaf6bec2fcd
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Fri Jan 18 17:55:27 2013 +0100
+++ b/src/tools/xml_tools.py	Fri Jan 18 17:55:34 2013 +0100
@@ -27,20 +27,20 @@
 
 """This library help manage XML used in SàT (parameters, registration, etc) """
 
-    
+
 def dataForm2xml(form):
     """Take a data form (xep-0004, Wokkel's implementation) and convert it to a SàT xml"""
-    
+
     form_ui = XMLUI("form", "vertical")
 
     if form.instructions:
         form_ui.addText('\n'.join(form.instructions), 'instructions')
-    
+
     labels = filter(lambda field:field.label,form.fieldList)
     if labels:
         #if there is no label, we don't need to use pairs
         form_ui.changeLayout("pairs")
-    
+
     for field in form.fieldList:
         if field.fieldType == 'fixed':
             __field_type = 'text'
@@ -53,14 +53,14 @@
         else:
             error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
             __field_type = "string"
-        
+
         if labels:
             if field.label:
                 form_ui.addLabel(field.label)
             else:
                 form_ui.addEmpty()
 
-        elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options]) 
+        elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options])
     return form_ui.toXml()
 
 def tupleList2dataForm(values):
@@ -104,7 +104,7 @@
 
     return param_ui.toXml()
 
-    
+
 
 
 class XMLUI:
@@ -140,8 +140,8 @@
         self.changeLayout(layout)
 
     def __del__(self):
-        self.doc.unlink() 
-    
+        self.doc.unlink()
+
     def __createLayout(self, layout, parent=None):
         """Create a layout element
         @param type: layout type (cf init doc)
@@ -182,7 +182,7 @@
     def addEmpty(self, name=None):
         """Add a multi-lines text"""
         elem = self.__createElem('empty', name, self.currentLayout)
-    
+
     def addText(self, text, name=None):
         """Add a multi-lines text"""
         elem = self.__createElem('text', name, self.currentLayout)
@@ -199,7 +199,7 @@
         elem = self.__createElem('string', name, self.currentLayout)
         if value:
             elem.setAttribute('value', value)
-    
+
     def addPassword(self, name=None, value=None):
         """Add a password box"""
         elem = self.__createElem('password', name, self.currentLayout)
@@ -211,20 +211,20 @@
         elem = self.__createElem('textbox', name, self.currentLayout)
         if value:
             elem.setAttribute('value', value)
-    
+
     def addBool(self, name=None, value="true"):
         """Add a string box"""
         assert value in ["true","false"]
         elem = self.__createElem('bool', name, self.currentLayout)
         elem.setAttribute('value', value)
-    
+
     def addList(self, options, name=None, value=None, style=set()):
         """Add a list of choices"""
         styles = set(style)
         assert (options)
-        assert (styles.issubset(['multi'])) 
+        assert (styles.issubset(['multi']))
         elem = self.__createElem('list', name, self.currentLayout)
-        self.addOptions(options, elem) 
+        self.addOptions(options, elem)
         if value:
             elem.setAttribute('value', value)
         for style in styles:
@@ -245,7 +245,7 @@
             elem.appendChild(fback_el)
 
 
-    
+
     def addElement(self, type, name = None, value = None, options = None, callback_id = None):
         """Convenience method to add element, the params correspond to the ones in addSomething methods"""
         if type == 'empty':
@@ -299,7 +299,7 @@
         self.parentTabsLayout.appendChild(cat)
 
     def toXml(self):
-        """return the XML representation of the panel""" 
+        """return the XML representation of the panel"""
         return self.doc.toxml()
 
 
@@ -325,4 +325,4 @@
         tmp = domish.Element((None, "s"))
         tmp.addRawXml(s.replace('\n','').replace('\t',''))
         parser.parse(tmp.toXml().encode('utf-8'))
-        return self.result.firstChildElement() 
+        return self.result.firstChildElement()