1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

magic-removal: Fixed #1651 -- 'startproject' and 'startapp' now copy permission bits. Thanks, pb

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-04-17 14:05:40 +00:00
parent ccc46a0f2f
commit 8117acaca1

View File

@ -3,7 +3,7 @@
import django
from django.core.exceptions import ImproperlyConfigured
import os, re, sys, textwrap
import os, re, shutil, sys, textwrap
from optparse import OptionParser
from django.utils import termcolors
@ -631,11 +631,14 @@ def _start_helper(app_or_project, name, directory, other_name=''):
for f in files:
if f.endswith('.pyc'):
continue
fp_old = open(os.path.join(d, f), 'r')
fp_new = open(os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name)), 'w')
path_old = os.path.join(d, f)
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_old.close()
fp_new.close()
shutil.copymode(path_old, path_new)
def startproject(project_name, directory):
"Creates a Django project for the given project_name in the given directory."