aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions/__init__.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2015-02-05 21:24:19 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2015-02-05 21:24:19 -0500
commit75855cdcca179f2a332bddfc4ea7c9730f701360 (patch)
tree980bc5e12e1dcddea519a8a7f1f78c31f174727e /markdown/extensions/__init__.py
parent044c0f2f61c2e289c1e231260a97b770794c8a2d (diff)
downloadmarkdown-75855cdcca179f2a332bddfc4ea7c9730f701360.tar.gz
markdown-75855cdcca179f2a332bddfc4ea7c9730f701360.tar.bz2
markdown-75855cdcca179f2a332bddfc4ea7c9730f701360.zip
Upgraded to DeprecationWarning on ext `config` keyword.
Also checked for `None` so the existing extensions will at least still work. Of course, that code all gets deleted with the next release and things will break if extension authors do not update their code. Hope they test there code with each release and check for warnings. Also added a note to the release notes.
Diffstat (limited to 'markdown/extensions/__init__.py')
-rw-r--r--markdown/extensions/__init__.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/markdown/extensions/__init__.py b/markdown/extensions/__init__.py
index a823fef..6e7a08a 100644
--- a/markdown/extensions/__init__.py
+++ b/markdown/extensions/__init__.py
@@ -26,25 +26,27 @@ class Extension(object):
# check for configs arg for backward compat.
# (there only ever used to be one so we use arg[0])
if len(args):
- self.setConfigs(args[0])
+ if args[0] is not None:
+ self.setConfigs(args[0])
warnings.warn('Extension classes accepting positional args is '
'pending Deprecation. Each setting should be '
'passed into the Class as a keyword. Positional '
- 'args will be deprecated in version 2.6 and raise '
+ 'args are deprecated and will raise '
'an error in version 2.7. See the Release Notes for '
- 'Python-Markdown version 2.5 for more info.',
- PendingDeprecationWarning)
+ 'Python-Markdown version 2.6 for more info.',
+ DeprecationWarning)
# check for configs kwarg for backward compat.
if 'configs' in kwargs.keys():
- self.setConfigs(kwargs.pop('configs', {}))
+ if kwargs['configs'] is not None:
+ self.setConfigs(kwargs.pop('configs', {}))
warnings.warn('Extension classes accepting a dict on the single '
'keyword "config" is pending Deprecation. Each '
'setting should be passed into the Class as a '
- 'keyword directly. The "config" keyword will be '
- 'deprecated in version 2.6 and raise an error in '
+ 'keyword directly. The "config" keyword is '
+ 'deprecated and raise an error in '
'version 2.7. See the Release Notes for '
- 'Python-Markdown version 2.5 for more info.',
- PendingDeprecationWarning)
+ 'Python-Markdown version 2.6 for more info.',
+ DeprecationWarning)
# finally, use kwargs
self.setConfigs(kwargs)