Better variable naming, and small optimization.
authorEdouard Tisserant
Wed, 14 Feb 2018 14:48:40 +0100
changeset 1932 65d2dbbf7022
parent 1931 7e6b03251bfe
child 1933 cef288644088
Better variable naming, and small optimization.
ConfigTreeNode.py
--- a/ConfigTreeNode.py	Tue Feb 13 14:01:20 2018 +0100
+++ b/ConfigTreeNode.py	Wed Feb 14 14:48:40 2018 +0100
@@ -410,15 +410,16 @@
             res = "%s_%d" % (BaseDesiredName, suffix)
             suffix += 1
 
-        # Get old path
-        oldname = self.CTNPath()
         # Check previous confnode existance
         dontexist = self.BaseParams.getName() == "__unnamed__"
+        if not dontexist:
+            # Get old path
+            oldpath = self.CTNPath()
         # Set the new name
         self.BaseParams.setName(res)
         # Rename confnode dir if exist
         if not dontexist:
-            shutil.move(oldname, self.CTNPath())
+            shutil.move(oldpath, self.CTNPath())
         # warn user he has two left hands
         if DesiredName != res:
             msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1=DesiredName, a2=res)