forked from django-extensions/django-extensions
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ticket django-extensions#180 import error _make_writeable does not ex…
…ist in django 1.4-beta the _make_writeable function has been inlined into TemplateCommand class in the django 1.4 and up. we should probably rewrite the commands to use the TemplateCommand class instead of duplicating code. But for now I moved the _make_writeable function to django_extensions.management.utils so that the existing commands keep working with Django 1.4 and up.
- Loading branch information
Showing
4 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
from django.conf import settings | ||
import os | ||
import sys | ||
|
||
|
||
def get_project_root(): | ||
""" get the project root directory """ | ||
settings_mod = __import__(settings.SETTINGS_MODULE, {}, {}, ['']) | ||
return os.path.dirname(os.path.abspath(settings_mod.__file__)) | ||
|
||
def _make_writeable(filename): | ||
""" | ||
Make sure that the file is writeable. Useful if our source is | ||
read-only. | ||
""" | ||
import stat | ||
if sys.platform.startswith('java'): | ||
# On Jython there is no os.access() | ||
return | ||
if not os.access(filename, os.W_OK): | ||
st = os.stat(filename) | ||
new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR | ||
os.chmod(filename, new_permissions) | ||
|