1409d65bc5ab — cedricbonhomme 11 years ago
Bug fix : UnboundLocalError in xmlParser.getPassword(). Hide the password in the password entry.
2 files changed, 14 insertions(+), 18 deletions(-)

M source/simpleGui.py
M source/xmlParser.py
M source/simpleGui.py +6 -3
@@ 337,7 337,7 @@ class SimpleGui(object):
 
 
         if self.client_agent == None:
-            self.show_info('Not connected to the SPADE platform.')
+            self.show_info('You are not connected to the SPADE platform.')
             return
 
         msg = Toplevel(self.master)

          
@@ 353,10 353,12 @@ class SimpleGui(object):
 
         Label(msg, text='Password : ').grid(row = 1, column = 0, sticky = W)
         password1_entry = Entry(msg)
+        password1_entry.configure(show='*')
         password1_entry.grid(row = 1, column = 1, pady = 2, sticky = W)
 
         Label(msg, text='Password : ').grid(row = 2, column = 0, sticky = W)
         password2_entry = Entry(msg)
+        password2_entry.configure(show='*')
         password2_entry.grid(row = 2, column = 1, pady = 2, sticky = W)
 
         Label(msg, text='Ontology : ').grid(row = 3, column = 0, sticky = W)

          
@@ 400,7 402,7 @@ class SimpleGui(object):
             self.load_rsa_keys()
 
         if self.client_agent == None:
-            self.show_info('Not connected to the SPADE platform.')
+            self.show_info('You are not connected to the SPADE platform.')
             return
 
         msg = Toplevel(self.master)

          
@@ 409,6 411,7 @@ class SimpleGui(object):
 
         Label(msg, text='Enter your password : ').grid(row = 0, column = 0)
         password_entry = Entry(msg)
+        password_entry.configure(show='*')
         password_entry.grid(row = 1, column = 0, pady = 2)
         password_entry.focus_set()
 

          
@@ 472,10 475,10 @@ class SimpleGui(object):
 
         self.set_top_level_window(msg)
 
-
     def block_sender(self, event = None):
         """
         Block the selected client.
+        Message from this client will be
         """
         client = None
         try:

          
M source/xmlParser.py +8 -15
@@ 41,7 41,7 @@ def add_client(client_name, client_passw
     """
     try:
         xml = parse(XML_FILE)
-    except Exception, e:
+    except Exception:
         xml = Document()
         root = xml.createElement("clients")
         xml.appendChild(root)

          
@@ 83,14 83,13 @@ def del_client():
     """
     pass
 
-
 def get_ontology(client_name):
     """
     """
     try:
         xml = parse(XML_FILE)
-    except Exception, e:
-        print e
+    except Exception:
+        return None
 
     for client in xml.getElementsByTagName("client"):
         if client_name == client.getElementsByTagName("name")[0].childNodes[0].nodeValue:

          
@@ 105,8 104,8 @@ def get_password(client_name):
     """
     try:
         xml = parse(XML_FILE)
-    except Exception, e:
-        print e
+    except Exception:
+        return None
 
     for client in xml.getElementsByTagName("client"):
         if client_name == client.getElementsByTagName("name")[0].childNodes[0].nodeValue:

          
@@ 121,8 120,8 @@ def get_pub_key(client_name):
     """
     try:
         xml = parse(XML_FILE)
-    except Exception, e:
-        print e
+    except Exception:
+        return None
 
     for client in xml.getElementsByTagName("client"):
         if client_name == client.getElementsByTagName("name")[0].childNodes[0].nodeValue:

          
@@ 132,10 131,6 @@ def get_pub_key(client_name):
                 pass
     return None
 
-
-
-
-
 def set_ontology():
     """
     """

          
@@ 151,10 146,8 @@ def set_password():
     """
     pass
 
-
-
 def write(xml):
-    """Save XML file.
+    """Save the XML file.
     """
     try:
         file = open(XML_FILE, 'w')