diff options
| author | Peter Inglesby <peter.inglesby@gmail.com> | 2016-08-05 14:09:20 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-05 12:09:45 -0400 |
| commit | e139ef5741716d8cb715ff17da2b33df08d85309 (patch) | |
| tree | a24d7c323a1a0741c73f91af140a65fff3e651df | |
| parent | 3c20aa49d746471ea55e106796cc1d349a5769b8 (diff) | |
Fixed #27023 -- Prevented possibility of shell loading ~/.pythonrc.py twice.
| -rw-r--r-- | django/core/management/commands/shell.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/management/commands/shell.py b/django/core/management/commands/shell.py index d6d6f6a087..b4e9caf0d1 100644 --- a/django/core/management/commands/shell.py +++ b/django/core/management/commands/shell.py @@ -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: |
