Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#19164 closed Bug (fixed)

Argumented added on the LazySettings.setup method, breaks diffsettings command

Reported by: Mario César Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords:
Cc: Carl Meyer Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


Related to ticket #18545, it was added an argument to the setup method of the LazySettings object.

The diffsettings command call settings._setup() to force load all settings and then show to the user.

$ python diffsettings --traceback
Traceback (most recent call last):
  File "/home/mariocesar/Proyectos/Crowddeals/env/local/lib/python2.7/site-packages/django/core/management/", line 222, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/mariocesar/Proyectos/Crowddeals/env/local/lib/python2.7/site-packages/django/core/management/", line 252, in execute
    output = self.handle(*args, **options)
  File "/home/mariocesar/Proyectos/Crowddeals/env/local/lib/python2.7/site-packages/django/core/management/", line 382, in handle
    return self.handle_noargs(**options)
  File "/home/mariocesar/Proyectos/Crowddeals/env/local/lib/python2.7/site-packages/django/core/management/commands/", line 19, in handle_noargs
TypeError: _setup() takes exactly 2 arguments (1 given)

An option for a fix could be making the argument optional

class LazySettings(LazyObject):
    A lazy proxy for either global Django settings or a custom settings object.
    The user can manually configure settings prior to using them. Otherwise,
    Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE.
    def _setup(self, name=None):


Change History (5)

comment:1 Changed 10 years ago by Mario César

Has patch: unset
Needs tests: set

comment:2 Changed 10 years ago by Łukasz Rekucki

Triage Stage: UnreviewedAccepted

comment:3 Changed 10 years ago by Mario César

I'm proposing a solution →

pd: First time trying to get in order to send a patch, really excited :)

comment:4 Changed 10 years ago by Carl Meyer <carl@…>

Resolution: fixed
Status: newclosed

In 3541a10d492db6d1f509f3a50a024568c16c5229:

Fixed #19164 -- Fixed diffsettings command broken in fix for #18545.

Thanks Mario César for the report and draft patch.

comment:5 Changed 10 years ago by Carl Meyer

Thanks for the report and patch! I used the basic approach, but there was some trouble with running diffsettings in-process using call_command in the test; it seemed to cause trouble with other tests when the full suite was run. I didn't dig deeply into that, instead I added a diffsettings test in the admin_scripts tests which already have a framework for testing management commands in a subprocess.

Also, the possibility of name being None needed to be accounted for later in _setup where name was used.

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