本文整理汇总了Python中pelican.settings.DEFAULT_CONFIG.copy方法的典型用法代码示例。如果您正苦于以下问题:Python DEFAULT_CONFIG.copy方法的具体用法?Python DEFAULT_CONFIG.copy怎么用?Python DEFAULT_CONFIG.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pelican.settings.DEFAULT_CONFIG
的用法示例。
在下文中一共展示了DEFAULT_CONFIG.copy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_do_not_use_folder_as_category
# 需要导入模块: from pelican.settings import DEFAULT_CONFIG [as 别名]
# 或者: from pelican.settings.DEFAULT_CONFIG import copy [as 别名]
def test_do_not_use_folder_as_category(self):
settings = DEFAULT_CONFIG.copy()
settings['ARTICLE_DIR'] = 'content'
settings['DEFAULT_CATEGORY'] = 'Default'
settings['DEFAULT_DATE'] = (1970, 1, 1)
settings['USE_FOLDER_AS_CATEGORY'] = False
settings['filenames'] = {}
generator = ArticlesGenerator(
settings.copy(), settings, CUR_DIR, DEFAULT_CONFIG['THEME'], None,
DEFAULT_CONFIG['MARKUP'])
generator.generate_context()
# test for name
# categories are grouped by slug; if two categories have the same slug
# but different names they will be grouped together, the first one in
# terms of process order will define the name for that category
categories = [cat.name for cat, _ in generator.categories]
categories_alternatives = (
sorted(['Default', 'Yeah', 'test', '指導書']),
sorted(['Default', 'yeah', 'test', '指導書']),
)
self.assertTrue(sorted(categories) in categories_alternatives)
# test for slug
categories = [cat.slug for cat, _ in generator.categories]
categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
self.assertEqual(sorted(categories), sorted(categories_expected))
示例2: get_settings
# 需要导入模块: from pelican.settings import DEFAULT_CONFIG [as 别名]
# 或者: from pelican.settings.DEFAULT_CONFIG import copy [as 别名]
def get_settings(**kwargs):
"""Provide tweaked setting dictionaries for testing
Set keyword arguments to override specific settings.
"""
settings = DEFAULT_CONFIG.copy()
for key,value in kwargs.items():
settings[key] = value
return settings
示例3: get_settings
# 需要导入模块: from pelican.settings import DEFAULT_CONFIG [as 别名]
# 或者: from pelican.settings.DEFAULT_CONFIG import copy [as 别名]
def get_settings(**kwargs):
settings = DEFAULT_CONFIG.copy()
for key, value in kwargs.items():
settings[key] = value
settings['PLUGINS'] = ['microdata']
return settings
示例4: get_settings
# 需要导入模块: from pelican.settings import DEFAULT_CONFIG [as 别名]
# 或者: from pelican.settings.DEFAULT_CONFIG import copy [as 别名]
def get_settings(**kwargs):
settings = DEFAULT_CONFIG.copy()
for key, value in kwargs.items():
settings[key] = value
return settings
示例5: setUp
# 需要导入模块: from pelican.settings import DEFAULT_CONFIG [as 别名]
# 或者: from pelican.settings.DEFAULT_CONFIG import copy [as 别名]
def setUp(self):
settings = DEFAULT_CONFIG.copy()
settings['EXTRA_TEMPLATES_PATHS'] = ['.']
context = settings.copy()
self.generator = Generator(context, settings, settings['PATH'],
settings['THEME'], settings['OUTPUT_PATH'])
示例6: create_generator
# 需要导入模块: from pelican.settings import DEFAULT_CONFIG [as 别名]
# 或者: from pelican.settings.DEFAULT_CONFIG import copy [as 别名]
def create_generator(path):
settings = DEFAULT_CONFIG.copy()
settings['filenames'] = {}
settings['CACHE_CONTENT'] = False # cache not needed for this logic tests
return ArticlesGenerator(context=settings.copy(), settings=settings,
path=path, theme=settings['THEME'], output_path=None)