fields validate fixed , now handles both wizard and dialog
authorDhananjay Sathe <dhananjaysathe@gmail.com>
Wed, 3 Aug 2011 14:58:07 +0000 (20:28 +0530)
committerDhananjay Sathe <dhananjaysathe@gmail.com>
Wed, 3 Aug 2011 14:58:07 +0000 (20:28 +0530)
sambagtk/pygwshare.py
sambagtk/pysrvsvc.py

index 1cc264e4446577175f05da09ceacb99cefc4cd09..a72956a18c10f60c0765a4f770f9dcf9ca07c86b 100644 (file)
@@ -211,12 +211,12 @@ class srvsvcPipeManager(object):
             if os.path.exists(path):
                 path = os.path.realpath(path)  # gets canonical path
             else:
-                raise OSError
+                raise OSError("Path does not exist !")
 
-            if path.startswith('/'):
-                path = path.replace('/', '\\')
-                path = ''.join(['C:',path])
-                path = unicode(path)
+        if path.startswith('/'):
+            path = path.replace('/', '\\')
+            path = ''.join(['C:',path])
+            path = unicode(path)
 
         return path
 
index 2c65b520016630c7b02b55fbb8d934d4b18fe260..22fd5efa77973abe1ef69e5fb382333b4ee7228e 100644 (file)
@@ -270,15 +270,20 @@ class ShareAddEditDialog(gtk.Dialog):
 
     def validate_fields(self):
 
-        if len(self.sname) == 0:
+        if type(self) is ShareAddEditDialog :
+            name = self.share_name_entry.get_text()
+        elif type(self) is ShareWizardDialog :
+            name = self.sname
+
+        if len(name) == 0:
             return "Share name may not be empty!"
 
-        if not self.pipe.name_validate(self.sname):
+        if not self.pipe.name_validate(name):
             return "Invalid Share name"
 
         if (not self.edit_mode):
             for share in self.pipe.share_list:
-                if share.name == self.share_name_entry.get_text():
+                if share.name == name:
                     return ' '.join(["A Share with the name : ", share.name ,"already exists!"])
 
         return None