mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Fixed #17099 -- Removed an out-of-date warning and some unused code, now that startapp doesn't require creating app inside project. Thanks ptone for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -357,7 +357,7 @@ class NoArgsCommand(BaseCommand):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def copy_helper(style, app_or_project, name, directory, other_name=''):
|
||||
def copy_helper(style, app_or_project, name, directory):
|
||||
"""
|
||||
Copies either a Django application layout template or a Django project
|
||||
layout template into the specified directory.
|
||||
@@ -367,11 +367,9 @@ def copy_helper(style, app_or_project, name, directory, other_name=''):
|
||||
# app_or_project -- The string 'app' or 'project'.
|
||||
# name -- The name of the application or project.
|
||||
# directory -- The directory to which the layout template should be copied.
|
||||
# other_name -- When copying an application layout, this should be the name
|
||||
# of the project.
|
||||
import re
|
||||
import shutil
|
||||
other = {'project': 'app', 'app': 'project'}[app_or_project]
|
||||
|
||||
if not re.search(r'^[_a-zA-Z]\w*$', name): # If it's not a valid directory name.
|
||||
# Provide a smart error message, depending on the error.
|
||||
if not re.search(r'^[_a-zA-Z]', name):
|
||||
@@ -406,7 +404,7 @@ def copy_helper(style, app_or_project, name, directory, other_name=''):
|
||||
path_new = os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name))
|
||||
fp_old = open(path_old, 'r')
|
||||
fp_new = open(path_new, 'w')
|
||||
fp_new.write(fp_old.read().replace('{{ %s_name }}' % app_or_project, name).replace('{{ %s_name }}' % other, other_name))
|
||||
fp_new.write(fp_old.read().replace('{{ %s_name }}' % app_or_project, name))
|
||||
fp_old.close()
|
||||
fp_new.close()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user