PY-13434 Pycharm 3.4 with Django 1.7 still calls setup_environ in helper django_manage_shell.py, create invalid superuser

This commit is contained in:
Ilya.Kazakevich
2014-09-17 17:47:04 +04:00
parent 61c2f186f2
commit d1a57f6f4d
+23 -5
View File
@@ -6,19 +6,37 @@ from pycharm_run_utils import adjust_django_sys_path
from fix_getpass import fixGetpass
try:
from runpy import run_module
from runpy import run_module
except ImportError:
from runpy_compat import run_module
from runpy_compat import run_module
adjust_django_sys_path()
base_path = sys.argv.pop()
manage_file = os.getenv('PYCHARM_DJANGO_MANAGE_MODULE')
if not manage_file:
manage_file = 'manage'
manage_file = 'manage'
class _PseudoTTY(object):
"""
Wraps stdin to return "true" for isatty() to fool
"""
def __init__(self, underlying):
self.__underlying = underlying
def __getattr__(self, name):
return getattr(self.__underlying, name)
def isatty(self):
return True
if __name__ == "__main__":
fixGetpass()
run_module(manage_file, None, '__main__', True)
fixGetpass()
command = sys.argv[1]
if command in ["syncdb", "createsuperuser"]: # List of commands that need stdin to be cheated
sys.stdin = _PseudoTTY(sys.stdin)
run_module(manage_file, None, '__main__', True)