Opened 17 years ago

Closed 16 years ago

#6654 closed (fixed)

django-admin.py startproject/startapp commands fixes

Reported by: Ivan Illarionov Owned by: Ivan Illarionov
Component: Core (Management commands) Version: dev
Severity: Keywords: startproject startapp command
Cc: ivan.illarionov@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django-admin.py startproject command can create projects with names that conflict with existing installed Python modules. I fixed this. See attached patch. It won't allow users accidentally block existing python modules or create several projects with the same name in different places and therefore prevent potential hard-to-diagnose bugs.

Attachments (4)

startproject.patch (1.3 KB ) - added by Ivan Illarionov 17 years ago.
startproject command fix
startproject-7320.patch (1.3 KB ) - added by Ivan Illarionov 17 years ago.
Updated to latest revision
startproject-startapp.patch (2.5 KB ) - added by Ivan Illarionov 17 years ago.
startapp included
startproject-startapp.2.patch (2.3 KB ) - added by Ivan Illarionov 17 years ago.
fixed startapp.py

Download all attachments as: .zip

Change History (12)

by Ivan Illarionov, 17 years ago

Attachment: startproject.patch added

startproject command fix

by Ivan Illarionov, 17 years ago

Attachment: startproject-7320.patch added

Updated to latest revision

comment:1 by Ramiro Morales, 17 years ago

This same problem was dealt at exactly that commit ([7320]) but in a slightly different way (it also checks importing a module with that name but additionally compares it against against the INVALID_PROJECT_NAMES list. Are you saying with your patch that the INVALID_PROJECT_NAMES test isn't necessary?. #6509 is similar but for startapp.

in reply to:  1 ; comment:2 by Ivan Illarionov, 17 years ago

Replying to ramiro:

This same problem was dealt at exactly that commit ([7320]) but in a slightly different way (it also checks importing a module with that name but additionally compares it against against the INVALID_PROJECT_NAMES list. Are you saying with your patch that the INVALID_PROJECT_NAMES test isn't necessary?. #6509 is similar but for startapp.
Yes, that's why I updated it. All names in INVALID_PROJECT_NAMES will be detected by import.

in reply to:  2 comment:3 by Ivan Illarionov, 17 years ago

Replying to i_i:

Replying to ramiro:

This same problem was dealt at exactly that commit ([7320]) but in a slightly different way (it also checks importing a module with that name but additionally compares it against against the INVALID_PROJECT_NAMES list. Are you saying with your patch that the INVALID_PROJECT_NAMES test isn't necessary?. #6509 is similar but for startapp.

Yes, that's why I updated it. All names in INVALID_PROJECT_NAMES will be detected by import.

by Ivan Illarionov, 17 years ago

Attachment: startproject-startapp.patch added

startapp included

comment:4 by Ivan Illarionov, 17 years ago

Comments:

  1. Names django, test and site will all be imported in the try/except/else clause and generate CommandError. This makes INVALID_PROJECT_NAMES test unnecessary.
  1. Ticket #6789 that was committed in 7320 is a duplicate of this ticket and deals with the same problem in a less efficient way.
  1. The fix for #6509 is also added.

by Ivan Illarionov, 17 years ago

fixed startapp.py

comment:5 by Ivan Illarionov, 17 years ago

Owner: changed from nobody to Ivan Illarionov

comment:6 by Ivan Illarionov, 17 years ago

Keywords: startapp added
Summary: django-admin.py startproject command enhancement/fixdjango-admin.py startproject/startapp commands fixes

comment:7 by Simon Greenhill, 16 years ago

Triage Stage: UnreviewedReady for checkin

comment:8 by Adrian Holovaty, 16 years ago

Resolution: fixed
Status: newclosed

(In [7652]) Fixed #6654 -- Slightly refactored the way 'startproject' and 'startapp' check for existing Python modules. Thanks, i_i

Note: See TracTickets for help on using tickets.
Back to Top