Skip to content

Commit

Permalink
Add pretty-printting of settings as dict if using IPython shell
Browse files Browse the repository at this point in the history
  • Loading branch information
redapple committed Feb 1, 2016
1 parent d843a0a commit 268e912
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scrapy/settings/__init__.py
Expand Up @@ -4,6 +4,7 @@
import warnings
from collections import MutableMapping
from importlib import import_module
from pprint import pformat

from scrapy.utils.deprecate import create_deprecated_class
from scrapy.exceptions import ScrapyDeprecationWarning
Expand Down Expand Up @@ -388,6 +389,12 @@ def copy_to_dict(self):
settings = self.copy()
return settings._to_dict()

def _repr_pretty_(self, p, cycle):
if cycle:
p.text(repr(self))
else:
p.text(pformat(self.copy_to_dict()))

@property
def overrides(self):
warnings.warn("`Settings.overrides` attribute is deprecated and won't "
Expand Down

0 comments on commit 268e912

Please sign in to comment.