Ticket #4282: permissions.patch
File permissions.patch, 1.4 KB (added by , 17 years ago) |
---|
-
django/core/management.py
5 5 from django.core.exceptions import ImproperlyConfigured 6 6 from optparse import OptionParser 7 7 from django.utils import termcolors 8 import os, re, s hutil, sys, textwrap8 import os, re, stat, sys, textwrap 9 9 10 10 try: 11 11 set … … 791 791 flush.help_doc = "Executes ``sqlflush`` on the current database." 792 792 flush.args = '[--verbosity] [--noinput]' 793 793 794 def _copy_execute_permission(path_old, path_new): 795 if hasattr(os, 'chmod'): 796 st = os.stat(path_old) 797 mode = stat.S_IMODE(st.st_mode) 798 if mode & 0111: 799 new_mode = stat.S_IMODE(os.stat(path_new).st_mode) 800 os.chmod(path_new, new_mode | 0111) 801 794 802 def _start_helper(app_or_project, name, directory, other_name=''): 795 803 other = {'project': 'app', 'app': 'project'}[app_or_project] 796 804 if not _is_valid_dir_name(name): … … 821 829 fp_old.close() 822 830 fp_new.close() 823 831 try: 824 shutil.copymode(path_old, path_new)832 _copy_execute_permission(path_old, path_new) 825 833 except OSError: 826 834 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)) 827 835