Permalink
Browse files

Fixed bug in django.core.management.base.copy_helper, related to refa…

…ctoring in [5903]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 3e20e7c commit e8cae6f96dce803f05a2f696ab968698f1389712 @adrianholovaty adrianholovaty committed Aug 16, 2007
@@ -65,7 +65,6 @@ def validate(self, app=None):
def handle(self, *args, **options):
raise NotImplementedError()
-
class AppCommand(BaseCommand):
args = '[appname ...]'
@@ -87,11 +86,10 @@ def handle(self, *app_labels, **options):
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 @@ def handle(self, *labels, **options):
def handle_label(self, label, **options):
raise NotImplementedError()
-
class NoArgsCommand(BaseCommand):
args = ''
@@ -120,8 +117,7 @@ def handle(self, *args, **options):
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 @@ def handle_label(self, app_name, directory=None, **options):
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 @@ def handle_label(self, project_name, **options):
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')

0 comments on commit e8cae6f

Please sign in to comment.