Code

Opened 7 years ago

Closed 7 years ago

#3905 closed (fixed)

app name incorrectly reported in syncdb output

Reported by: kbussell@… Owned by: adrian
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@… 7 years ago.
mgmt.diff (813 bytes) - added by Vinay Sajip <vinay_sajip@…> 7 years ago.
Path now relative to root directory

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by kbussell@…

comment:1 follow-up: Changed 7 years ago by mtredinnick

  • 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 7 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 7 years ago by Vinay Sajip <vinay_sajip@…>

  • Owner changed from adrian to anonymous
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

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 7 years ago by Vinay Sajip <vinay_sajip@…>

  • Owner changed from anonymous to adrian
  • Status changed from assigned to new

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

Path now relative to root directory

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

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.