Ticket #2956: management.py.diff

File management.py.diff, 1.2 KB (added by masonsimon+django@…, 18 years ago)

Patch that prompts user for action when permissions can't be set on a file.

  • management.py

     
    694694            fp_new.write(fp_old.read().replace('{{ %s_name }}' % app_or_project, name).replace('{{ %s_name }}' % other, other_name))
    695695            fp_old.close()
    696696            fp_new.close()
    697             shutil.copymode(path_old, path_new)
     697            try:
     698                shutil.copymode(path_old, path_new)
     699            except OSError:
     700                message = ("Unable to set permissions for '%s'. "
     701                           "Continue? (y/[n]): " % path_new)
     702                response = raw_input(message)
     703                if response in ("y", "Y", "yes", "Yes", "YES"):
     704                    # User accepts the permissioning issue.
    698705
     706                    # Continue executing the program:
     707                    pass
     708                else:
     709                    # User did not accept the permissioning issue.
     710                   
     711                    # Let the error continue bubbling:
     712                    raise
     713
    699714def startproject(project_name, directory):
    700715    "Creates a Django project for the given project_name in the given directory."
    701716    from random import choice
Back to Top