I have my project structure as following
├── app
│ ├── Country
│ │ └── views.py
│ ├── Customer
│ │ └── views.py
Where the module 'Country' folder is what I tried to rename it to 'Countries' and every occurrence it is used, and it is also imported in Customer/views.py
as well.
from app.Country.views import *
....
According to this tutorial Refactoring Python Applications for Simplicity, I tried it as below:
>>> from rope.base.project import Project
>>>
>>> proj = Project('app')
>>>
>>> Country = proj.get_folder('Country')
>>>
>>> from rope.refactor.rename import Rename
>>>
>>> change = Rename(proj, Country).get_changes('Countries')
>>> proj.do(change)
After executing the script, the module folder 'Country' was changed to 'Countries' but its instance where it is used in Customer/views.py does not change accordingly, the import statement in Customer/views.py is still
from app.Country.views import *
I expected it should change to from app.Countries.views import *
after refactoring, but it did not.
Is there anything else I should do to refactor this successfully? Thanks.
Country
in as a module usingproj.find_module('Country')
? – AngilaanginaCountry = proj.find_module('Country')
. It still does not work. the folder changed but the import statement in Customer/views.py did not change accordingly. Thanks. – Haphazardly