Kaydet (Commit) e139ef57 authored tarafından Peter Inglesby's avatar Peter Inglesby Kaydeden (comit) Tim Graham

Fixed #27023 -- Prevented possibility of shell loading ~/.pythonrc.py twice.

üst 3c20aa49
......@@ -2,6 +2,7 @@ import os
import warnings
from django.core.management.base import BaseCommand
from django.utils.datastructures import OrderedSet
from django.utils.deprecation import RemovedInDjango20Warning
......@@ -88,10 +89,9 @@ class Command(BaseCommand):
# We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system
# conventions and get $PYTHONSTARTUP first then .pythonrc.py.
if not options['no_startup']:
for pythonrc in (os.environ.get("PYTHONSTARTUP"), '~/.pythonrc.py'):
for pythonrc in OrderedSet([os.environ.get("PYTHONSTARTUP"), os.path.expanduser('~/.pythonrc.py')]):
if not pythonrc:
continue
pythonrc = os.path.expanduser(pythonrc)
if not os.path.isfile(pythonrc):
continue
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment