Opened 9 years ago

Closed 9 years ago

#3905 closed (fixed)

app name incorrectly reported in syncdb output

Reported by: kbussell@… Owned by: Adrian Holovaty
Component: Core (Other) Version: master
Severity: Keywords: syncdb
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

in syncdb(), the app_name variable isn't set in custom SQL installation loop, which can cause incorrect status messages.

Attachments (2)

core_management_py.patch (507 bytes) - added by kbussell@… 9 years ago.
mgmt.diff (813 bytes) - added by Vinay Sajip <vinay_sajip@…> 9 years ago.
Path now relative to root directory

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by kbussell@…

Attachment: core_management_py.patch added

comment:1 Changed 9 years ago by Malcolm Tredinnick

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Under what circumstances does this fail? Can you describe a simple example?

comment:2 in reply to:  1 Changed 9 years ago by kbussell@…

Replying to mtredinnick:

Under what circumstances does this fail? Can you describe a simple example?

Sorry about the terseness of the original message. It was such a simple fix, I didn't go into much detail. Apologies.

The output is incorrect whenever a custom SQL file exists for an application which isn't the last one listed in INSTALLED_APPS. Try creating a site with two apps, and create an sql file for the first one in the INSTALLED_APPS list. You'll see the output from syncdb shows the application name of the second app instead of the first.

It's easiest to see by just looking at the code--in the syncdb function, there are several loops through models.get_apps(). The first line after all but one sets the app_name variable to the current application name for use in print statements. The loop for installing custom SQL uses the app_name variable, but never updates it.

comment:3 Changed 9 years ago by Vinay Sajip <vinay_sajip@…>

Owner: changed from Adrian Holovaty to anonymous
Status: newassigned
Triage Stage: UnreviewedAccepted

I've confirmed that this happens, and that the error messages refer to the wrong app (the last app in INSTALLED_APPS). With the patch applied, the correct app name is used. I think this is ready for check-in.

comment:4 Changed 9 years ago by Vinay Sajip <vinay_sajip@…>

Owner: changed from anonymous to Adrian Holovaty
Status: assignednew

Changed 9 years ago by Vinay Sajip <vinay_sajip@…>

Attachment: mgmt.diff added

Path now relative to root directory

comment:5 Changed 9 years ago by Vinay Sajip <vinay_sajip@…>

Triage Stage: AcceptedReady for checkin

comment:6 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [5131]) Fixed #3905 -- Report app_name correctly in errors during custom SQL
installation. Thanks, kbussell@….

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