def initialized(pelican): from pelican.settings import DEFAULT_CONFIG DEFAULT_CONFIG.setdefault(WEBRING_FEED_URLS_STR, []) DEFAULT_CONFIG.setdefault(WEBRING_MAX_ARTICLES_STR, 3) DEFAULT_CONFIG.setdefault(WEBRING_ARTICLES_PER_FEED_STR, 1) DEFAULT_CONFIG.setdefault(WEBRING_SUMMARY_LENGTH_STR, 128) DEFAULT_CONFIG.setdefault(WEBRING_CLEAN_SUMMARY_HTML_STR, True) if pelican: for name, value in DEFAULT_CONFIG.items(): if name.startswith('WEBRING'): pelican.settings.setdefault(name, value)
def initialized(pelican): from pelican.settings import DEFAULT_CONFIG DEFAULT_CONFIG.setdefault(WEBRING_FEED_URLS_STR, []) DEFAULT_CONFIG.setdefault(WEBRING_MAX_ARTICLES_STR, 3) DEFAULT_CONFIG.setdefault(WEBRING_ARTICLES_PER_FEED_STR, 1) DEFAULT_CONFIG.setdefault(WEBRING_SUMMARY_WORDS_STR, 20) DEFAULT_CONFIG.setdefault(WEBRING_CLEAN_SUMMARY_HTML_STR, True) if pelican: # Check deprecated settings if "WEBRING_SUMMARY_LENGTH" in pelican.settings: warning( "webring plugin: '%s' has been deprecated by '%s'", "WEBRING_SUMMARY_LENGTH", "WEBRING_SUMMARY_WORDS", ) # Set default values for unset settings for name, value in DEFAULT_CONFIG.items(): if name.startswith("WEBRING"): pelican.settings.setdefault(name, value) # save global settings global settings settings = pelican.settings if pelican else DEFAULT_CONFIG