Ticket #4282: django-4282.diff
File django-4282.diff, 1.5 KB (added by , 17 years ago) |
---|
-
django/core/management/base.py
165 165 def copy_helper(style, app_or_project, name, directory, other_name=''): 166 166 import django 167 167 import re 168 import shutil169 168 other = {'project': 'app', 'app': 'project'}[app_or_project] 170 169 if not re.search(r'^\w+$', name): # If it's not a valid directory name. 171 170 raise CommandError("%r is not a valid %s name. Please use only numbers, letters and underscores." % (name, app_or_project)) … … 198 197 fp_old.close() 199 198 fp_new.close() 200 199 try: 201 shutil.copymode(path_old, path_new)200 _copy_execute_permission(path_old, path_new) 202 201 _make_writeable(path_new) 203 202 except OSError: 204 203 sys.stderr.write(style.NOTICE("Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.\n" % path_new)) … … 214 213 new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR 215 214 os.chmod(filename, new_permissions) 216 215 216 def _copy_execute_permission(path_old, path_new): 217 import stat 218 if hasattr(os, 'chmod'): 219 st = os.stat(path_old) 220 mode = stat.S_IMODE(st.st_mode) 221 if mode & 0111: 222 new_mode = stat.S_IMODE(os.stat(path_new).st_mode) 223 os.chmod(path_new, new_mode | 0111)