settings: Make DEFAULT_CONFIG public

This dictionary is accessed by plugins (like `summary`) which add new
settings, so it should be public (i.e. no prefixed underscore).

The changed name length would have led to a re-indenting of the
default contents anyway, so I shifted them all to four spaces.
This commit is contained in:
W. Trevor King 2013-03-24 08:38:19 -04:00
commit e9dc1dd478
6 changed files with 105 additions and 108 deletions

View file

@ -7,7 +7,7 @@ from sys import platform
from .support import unittest
from pelican.contents import Page, Article, URLWrapper
from pelican.settings import _DEFAULT_CONFIG
from pelican.settings import DEFAULT_CONFIG
from pelican.utils import truncate_html_words
from pelican.signals import content_object_init
from jinja2.utils import generate_lorem_ipsum
@ -62,7 +62,7 @@ class TestPage(unittest.TestCase):
# If a :SUMMARY_MAX_LENGTH: is set, and there is no other summary,
# generated summary should not exceed the given length.
page_kwargs = self._copy_page_kwargs()
settings = _DEFAULT_CONFIG.copy()
settings = DEFAULT_CONFIG.copy()
page_kwargs['settings'] = settings
del page_kwargs['metadata']['summary']
settings['SUMMARY_MAX_LENGTH'] = None
@ -83,7 +83,7 @@ class TestPage(unittest.TestCase):
def test_defaultlang(self):
# If no lang is given, default to the default one.
page = Page(**self.page_kwargs)
self.assertEqual(page.lang, _DEFAULT_CONFIG['DEFAULT_LANG'])
self.assertEqual(page.lang, DEFAULT_CONFIG['DEFAULT_LANG'])
# it is possible to specify the lang in the metadata infos
self.page_kwargs['metadata'].update({'lang': 'fr', })
@ -108,7 +108,7 @@ class TestPage(unittest.TestCase):
page = Page(**self.page_kwargs)
self.assertIn('summary', page.url_format.keys())
page.metadata['directory'] = 'test-dir'
page.settings = _DEFAULT_CONFIG.copy()
page.settings = DEFAULT_CONFIG.copy()
page.settings['PAGE_SAVE_AS'] = '{directory}/{slug}'
self.assertEqual(page.save_as, 'test-dir/foo-bar')
@ -123,10 +123,10 @@ class TestPage(unittest.TestCase):
page = Page(**page_kwargs)
self.assertEqual(page.locale_date,
dt.strftime(_DEFAULT_CONFIG['DEFAULT_DATE_FORMAT']))
dt.strftime(DEFAULT_CONFIG['DEFAULT_DATE_FORMAT']))
page_kwargs['settings'] = dict([(x, _DEFAULT_CONFIG[x]) for x in
_DEFAULT_CONFIG])
page_kwargs['settings'] = dict([(x, DEFAULT_CONFIG[x]) for x in
DEFAULT_CONFIG])
# I doubt this can work on all platforms ...
if platform == "win32":