Anonymous avatar 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')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.