Fixed bug in django.core.management.base.copy_helper, related to refactoring in [5903]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3e20e7cc41
commit
e8cae6f96d
|
@ -65,7 +65,6 @@ class BaseCommand(object):
|
|||
def handle(self, *args, **options):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class AppCommand(BaseCommand):
|
||||
args = '[appname ...]'
|
||||
|
||||
|
@ -87,11 +86,10 @@ class AppCommand(BaseCommand):
|
|||
def handle_app(self, app, **options):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class LabelCommand(BaseCommand):
|
||||
args = '[label ...]'
|
||||
label = 'label'
|
||||
|
||||
|
||||
def handle(self, *labels, **options):
|
||||
if not labels:
|
||||
raise CommandError('Enter at least one %s.' % self.label)
|
||||
|
@ -106,7 +104,6 @@ class LabelCommand(BaseCommand):
|
|||
def handle_label(self, label, **options):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class NoArgsCommand(BaseCommand):
|
||||
args = ''
|
||||
|
||||
|
@ -120,8 +117,7 @@ class NoArgsCommand(BaseCommand):
|
|||
def handle_noargs(self, **options):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def copy_helper(app_or_project, name, directory, other_name=''):
|
||||
def copy_helper(style, app_or_project, name, directory, other_name=''):
|
||||
import django
|
||||
import os
|
||||
import re
|
||||
|
@ -160,4 +156,4 @@ def copy_helper(app_or_project, name, directory, other_name=''):
|
|||
try:
|
||||
shutil.copymode(path_old, path_new)
|
||||
except OSError:
|
||||
sys.stderr.write(self.style.NOTICE("Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.\n" % path_new))
|
||||
sys.stderr.write(style.NOTICE("Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.\n" % path_new))
|
||||
|
|
|
@ -21,7 +21,7 @@ class Command(LabelCommand):
|
|||
project_name = os.path.basename(directory)
|
||||
if app_name == project_name:
|
||||
raise CommandError("You cannot create an app with the same name (%r) as your project." % app_name)
|
||||
copy_helper('app', app_name, directory, parent_dir)
|
||||
copy_helper(self.style, 'app', app_name, directory, parent_dir)
|
||||
|
||||
class ProjectCommand(Command):
|
||||
help = "Creates a Django app directory structure for the given app name in this project's directory."
|
||||
|
|
|
@ -23,7 +23,7 @@ class Command(LabelCommand):
|
|||
if project_name in INVALID_PROJECT_NAMES:
|
||||
raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
|
||||
|
||||
copy_helper('project', project_name, directory)
|
||||
copy_helper(self.style, 'project', project_name, directory)
|
||||
|
||||
# Create a random SECRET_KEY hash, and put it in the main settings.
|
||||
main_settings_file = os.path.join(directory, project_name, 'settings.py')
|
||||
|
|
Loading…
Reference in New Issue