diff --git a/gunicorn/config.py b/gunicorn/config.py index 086725bd..f21f74f8 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -308,6 +308,15 @@ class Setting(object): self.order < other.order) __cmp__ = __lt__ + def __repr__(self): + return "<%s.%s object at %x with value %r>" % ( + self.__class__.__module__, + self.__class__.__name__, + id(self), + self.value, + ) + + Setting = SettingMeta('Setting', (Setting,), {}) diff --git a/tests/test_config.py b/tests/test_config.py index 0587c63c..8b1922e6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -435,3 +435,10 @@ def test_bind_fd(): with AltArgs(["prog_name", "-b", "fd://42"]): app = NoConfigApp() assert app.cfg.bind == ["fd://42"] + + +def test_repr(): + c = config.Config() + c.set("workers", 5) + + assert "with value 5" in repr(c.settings['workers'])