Commits

Anonymous committed f4c4338

resources: reverted recursive parameter of Folder.create()

Comments (0)

Files changed (3)

rope/base/project.py

     def _init_ropefolder(self):
         if self.ropefolder is not None:
             if not self.ropefolder.exists():
-                self.ropefolder.create(recursive=True)
+                self._create_recursively(self.ropefolder)
             if not self.ropefolder.has_child('config.py'):
                 config = self.ropefolder.create_file('config.py')
                 config.write(self._default_config())
 
+    def _create_recursively(self, folder):
+        if folder.parent != self.root and not folder.parent.exists():
+            self._create_recursively(folder.parent)
+        folder.create()
+
     def _init_prefs(self, prefs):
         run_globals = {}
         if self.ropefolder is not None:

rope/base/resources.py

             return False
         return self.path == '' or resource.path.startswith(self.path + '/')
 
-    def create(self, recursive=False):
-        if recursive and not self.parent.exists():
-            self.parent.create(recursive)
+    def create(self):
         self.parent.create_folder(self.name)
 
 

ropetest/projecttest.py

         self.assertEquals('sample notes', open(os.path.join(self.project.address,
                                                             file_path)).read())
 
-    def test_creating_folders_recursively(self):
-        folder_name = 'parent/nested'
-        self.project.get_folder(folder_name).create(recursive=True)
-        folder_path = os.path.join(self.project.address, folder_name)
-        self.assertTrue(os.path.exists(folder_path))
-
     @testutils.assert_raises(ResourceNotFoundError)
     def test_failing_when_creating_file_inside_non_existent_folder(self):
         self.project.root.create_file('NonexistentFolder/SomeFile.txt')