From 3e19109ab61f851683d9a6427a52b4866071fa60 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 19 Jan 2009 12:48:41 +0000 Subject: [PATCH] [1.0.X] Fixed #9789 -- Handle jython's compiled settings filename correctly. Patch from Frank Wierzbicki. Backport of r9775 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9776 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/core/management/__init__.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/AUTHORS b/AUTHORS index 557ca7d824..8333703d8b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -418,6 +418,7 @@ answer newbie questions, and generally made Django that much better: Chris Wesseling James Wheare Mike Wiacek + Frank Wierzbicki charly.wilhelm@gmail.com Rachel Willmer Gary Wilson diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 03c683b844..8076163df5 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -311,7 +311,14 @@ def setup_environ(settings_mod, original_settings_path=None): if project_directory == os.curdir or not project_directory: project_directory = os.getcwd() project_name = os.path.basename(project_directory) + + # Strip filename suffix to get the module name. settings_name = os.path.splitext(settings_filename)[0] + + # Strip $py for Jython compiled files (like settings$py.class) + if settings_name.endswith("$py"): + settings_name = settings_name[:-3] + sys.path.append(os.path.join(project_directory, os.pardir)) project_module = __import__(project_name, {}, {}, ['']) sys.path.pop()