Kaydet (Commit) 573f44d6 authored tarafından orlnub123's avatar orlnub123 Kaydeden (comit) Tim Graham

Fixed #30057 -- Fixed diffsettings ignoring custom configured settings.

Regression in 49b67937.
üst abf8e390
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_')): def module_to_dict(module, omittable=lambda k: k.startswith('_') or not k.isupper()):
"""Convert a module namespace to a Python dictionary.""" """Convert a module namespace to a Python dictionary."""
return {k: repr(v) for k, v in module.__dict__.items() if not omittable(k)} return {k: repr(getattr(module, k)) for k in dir(module) if not omittable(k)}
class Command(BaseCommand): class Command(BaseCommand):
......
...@@ -5,5 +5,5 @@ from django.conf import settings ...@@ -5,5 +5,5 @@ from django.conf import settings
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
if __name__ == '__main__': if __name__ == '__main__':
settings.configure(DEBUG=True) settings.configure(DEBUG=True, CUSTOM=1)
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)
...@@ -2236,7 +2236,7 @@ class DiffSettings(AdminScriptTestCase): ...@@ -2236,7 +2236,7 @@ class DiffSettings(AdminScriptTestCase):
def test_settings_configured(self): def test_settings_configured(self):
out, err = self.run_manage(['diffsettings'], configured_settings=True) out, err = self.run_manage(['diffsettings'], configured_settings=True)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'DEBUG = True') self.assertOutput(out, 'CUSTOM = 1 ###\nDEBUG = True')
def test_all(self): def test_all(self):
"""The all option also shows settings with the default value.""" """The all option also shows settings with the default value."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment