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