Ticket #1651: copymode.patch

File copymode.patch, 1.3 KB (added by pb@…, 18 years ago)

patch

  • django/core/management.py

     
    33
    44import django
    55from django.core.exceptions import ImproperlyConfigured
    6 import os, re, sys, textwrap
     6import os, re, shutil, sys, textwrap
    77from optparse import OptionParser
    88from django.utils import termcolors
    99
     
    631631        for f in files:
    632632            if f.endswith('.pyc'):
    633633                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')
    636638            fp_new.write(fp_old.read().replace('{{ %s_name }}' % app_or_project, name).replace('{{ %s_name }}' % other, other_name))
    637639            fp_old.close()
    638640            fp_new.close()
     641            shutil.copymode(path_old, path_new)
    639642
    640643def startproject(project_name, directory):
    641644    "Creates a Django project for the given project_name in the given directory."
Back to Top