Django

Code

Changeset 2709

Show
Ignore:
Timestamp:
04/17/06 09:05:40 (3 years ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/django/core/management.py

    r2693 r2709  
    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 
     
    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):