Ticket #1651: copymode.patch
File copymode.patch, 1.3 KB (added by , 19 years ago) |
---|
-
django/core/management.py
3 3 4 4 import django 5 5 from django.core.exceptions import ImproperlyConfigured 6 import os, re, s ys, textwrap6 import os, re, shutil, sys, textwrap 7 7 from optparse import OptionParser 8 8 from django.utils import termcolors 9 9 … … 631 631 for f in files: 632 632 if f.endswith('.pyc'): 633 633 continue 634 fp_old = open(os.path.join(d, f), 'r') 635 fp_new = open(os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name)), 'w') 634 path_old = os.path.join(d, f) 635 path_new = os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name)) 636 fp_old = open(path_old, 'r') 637 fp_new = open(path_new, 'w') 636 638 fp_new.write(fp_old.read().replace('{{ %s_name }}' % app_or_project, name).replace('{{ %s_name }}' % other, other_name)) 637 639 fp_old.close() 638 640 fp_new.close() 641 shutil.copymode(path_old, path_new) 639 642 640 643 def startproject(project_name, directory): 641 644 "Creates a Django project for the given project_name in the given directory."