8000 applied justin's patch for issue 47 · tdsprogramming/django-extensions@32ea0a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 32ea0a1

Browse files
author
v.oostveen
committed
applied justin's patch for issue 47
git-svn-id: https://django-command-extensions.googlecode.com/svn/trunk@188 70537768-783f-0410-b1a0-8399f7a62752
1 parent 94b36aa commit 32ea0a1

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

django_extensions/management/commands/create_jobs.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import os
22
import sys
3-
from imp import find_module
43
from django.core.management.base import CommandError, AppCommand, _make_writeable
5-
from optparse import make_option
64

75
class Command(AppCommand):
8-
option_list = AppCommand.option_list + (
9-
)
10-
11-
help = ("Creates a Django jobs command directory structure for the given app name"
12-
" in the current directory.")
6+
help = ("Creates a Django jobs command directory structure for the given app name in the current directory.")
137
args = "[appname]"
148
label = 'application name'
159

@@ -19,35 +13,9 @@ class Command(AppCommand):
1913
can_import_settings = True
2014

2115
def handle_app(self, app, **options):
22-
parts = app.__name__.split('.')[0:-1]
23-
parts.reverse()
24-
app_dir = None
25-
original_parts = list(parts)
26-
paths = list(sys.path)
27-
while parts:
28-
part = parts.pop()
29-
30-
# A part may be missing if namespace packages are being used.
31-
# Try to import, and if it fails, boot the whole failing app_dir out
32-
# of our path search list. Reraise the import error if we run out of
33-
# paths to try.
34-
try:
35-
f, app_dir, descr = find_module(part, app_dir and [app_dir] or paths)
36-
except ImportError:
37-
paths = [p for p in paths if not app_dir.startswith(p)]
38-
if not paths:
39-
raise
40-
app_dir = None
41-
parts = list(original_parts)
42-
43-
if not os.path.exists(app_dir):
44-
try:
45-
os.mkdir(app_dir)
46-
except OSError, e:
47-
raise CommandError(e)
48-
16+
app_dir = os.path.dirname(app.__file__)
4917
copy_template('jobs_template', app_dir)
50-
18+
5119
def copy_template(template_name, copy_to):
5220
"""copies the specified template directory to the copy_to location"""
5321
import django_extensions

0 commit comments

Comments
 (0)
0