Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

django.core.management.execute_manager is deprecated #59

Merged
merged 1 commit into from Jan 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions funfactory/manage.py
Expand Up @@ -7,7 +7,7 @@


current_settings = None
execute_manager = None
execute_from_command_line = None
log = logging.getLogger(__name__)
ROOT = None

Expand All @@ -32,7 +32,7 @@ def setup_environ(manage_file, settings=None, more_pythonic=False):
This requires a newer Playdoh layout without top level apps, lib, etc.
"""
# sys is global to avoid undefined local
global sys, current_settings, execute_manager, ROOT
global sys, current_settings, execute_from_command_line, ROOT

ROOT = os.path.dirname(os.path.abspath(manage_file))

Expand Down Expand Up @@ -71,7 +71,7 @@ def setup_environ(manage_file, settings=None, more_pythonic=False):
sys.path.remove(item)
sys.path[:0] = new_sys_path

from django.core.management import execute_manager # noqa
from django.core.management import execute_from_command_line # noqa
if not settings:
if 'DJANGO_SETTINGS_MODULE' in os.environ:
settings = import_mod_by_name(os.environ['DJANGO_SETTINGS_MODULE'])
Expand Down Expand Up @@ -137,7 +137,8 @@ def _not_setup():
'setup_environ() has not been called for this process')


def main():
def main(argv=None):
if current_settings is None:
_not_setup()
execute_manager(current_settings)
argv = argv or sys.argv
execute_from_command_line(argv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine for newer Djangos but I guess it will break in older ones. Do we need to support both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"newer Djangos" :)
That's 1.4 we're talking about here. They're about to release 1.7 soon :)
I doubt anybody on django 1.3 is going to upgrade their funfactory to the latest and greatest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine by me. I don't know of anyone tied to 1.3 who would want to upgrade playdoh independently.