Update to 2.2.1.
This commit is contained in:
parent
278de90e41
commit
d400db7d92
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ Markdown-2.0.3.tar.gz
|
||||
/Markdown-2.1.0.tar.gz
|
||||
/Markdown-2.1.1.tar.gz
|
||||
/Markdown-2.2.0.tar.gz
|
||||
/Markdown-2.2.1.tar.gz
|
||||
|
@ -1,81 +0,0 @@
|
||||
diff --git a/markdown/__init__.py b/markdown/__init__.py
|
||||
index 64686c8..149ec30 100644
|
||||
--- a/markdown/__init__.py
|
||||
+++ b/markdown/__init__.py
|
||||
@@ -37,6 +37,7 @@ import re
|
||||
import codecs
|
||||
import sys
|
||||
import logging
|
||||
+import warnings
|
||||
import util
|
||||
from preprocessors import build_preprocessors
|
||||
from blockprocessors import build_block_parser
|
||||
@@ -163,10 +164,10 @@ class Markdown:
|
||||
if isinstance(ext, basestring):
|
||||
ext = self.build_extension(ext, configs.get(ext, []))
|
||||
if isinstance(ext, Extension):
|
||||
- # might raise NotImplementedError, but that's the extension author's problem
|
||||
ext.extendMarkdown(self, globals())
|
||||
elif ext is not None:
|
||||
- raise ValueError('Extension "%s.%s" must be of type: "markdown.Extension".' \
|
||||
+ raise TypeError(
|
||||
+ 'Extension "%s.%s" must be of type: "markdown.Extension"'
|
||||
% (ext.__class__.__module__, ext.__class__.__name__))
|
||||
|
||||
return self
|
||||
@@ -200,19 +201,22 @@ class Markdown:
|
||||
module_name_old_style = '_'.join(['mdx', ext_name])
|
||||
try: # Old style (mdx_<extension>)
|
||||
module = __import__(module_name_old_style)
|
||||
- except ImportError:
|
||||
- logger.warn("Failed loading extension '%s' from '%s' or '%s'"
|
||||
- % (ext_name, module_name, module_name_old_style))
|
||||
- # Return None so we don't try to initiate none-existant extension
|
||||
- return None
|
||||
+ except ImportError, e:
|
||||
+ message = "Failed loading extension '%s' from '%s' or '%s'" \
|
||||
+ % (ext_name, module_name, module_name_old_style)
|
||||
+ e.args = (message,) + e.args[1:]
|
||||
+ raise
|
||||
|
||||
# If the module is loaded successfully, we expect it to define a
|
||||
# function called makeExtension()
|
||||
try:
|
||||
return module.makeExtension(configs.items())
|
||||
except AttributeError, e:
|
||||
- logger.warn("Failed to initiate extension '%s': %s" % (ext_name, e))
|
||||
- return None
|
||||
+ message = e.args[0]
|
||||
+ message = "Failed to initiate extension " \
|
||||
+ "'%s': %s" % (ext_name, message)
|
||||
+ e.args = (message,) + e.args[1:]
|
||||
+ raise
|
||||
|
||||
def registerExtension(self, extension):
|
||||
""" This gets called by the extension """
|
||||
diff --git a/tests/test_apis.py b/tests/test_apis.py
|
||||
index 0296f27..31a60e1 100644
|
||||
--- a/tests/test_apis.py
|
||||
+++ b/tests/test_apis.py
|
||||
@@ -245,18 +245,18 @@ class TestErrors(unittest.TestCase):
|
||||
|
||||
def testLoadExtensionFailure(self):
|
||||
""" Test failure of an extension to load. """
|
||||
- self.assertRaises(ValueError,
|
||||
+ self.assertRaises(ImportError,
|
||||
markdown.Markdown, extensions=['non_existant_ext'])
|
||||
|
||||
def testLoadBadExtension(self):
|
||||
""" Test loading of an Extension with no makeExtension function. """
|
||||
_create_fake_extension(name='fake', has_factory_func=False)
|
||||
- self.assertRaises(ValueError, markdown.Markdown, extensions=['fake'])
|
||||
+ self.assertRaises(AttributeError, markdown.Markdown, extensions=['fake'])
|
||||
|
||||
def testNonExtension(self):
|
||||
""" Test loading a non Extension object as an extension. """
|
||||
_create_fake_extension(name='fake', is_wrong_type=True)
|
||||
- self.assertRaises(ValueError, markdown.Markdown, extensions=['fake'])
|
||||
+ self.assertRaises(TypeError, markdown.Markdown, extensions=['fake'])
|
||||
|
||||
def testBaseExtention(self):
|
||||
""" Test that the base Extension class will raise NotImplemented. """
|
@ -8,15 +8,13 @@
|
||||
%define srcname Markdown
|
||||
|
||||
Name: python-markdown
|
||||
Version: 2.2.0
|
||||
Release: 3%{?dist}
|
||||
Version: 2.2.1
|
||||
Release: 1%{?dist}
|
||||
Summary: Markdown implementation in Python
|
||||
Group: Development/Languages
|
||||
License: BSD
|
||||
URL: http://packages.python.org/Markdown/
|
||||
Source0: http://pypi.python.org/packages/source/M/%{srcname}/%{srcname}-%{version}.tar.gz
|
||||
# commit 5b3e724f
|
||||
Patch0: Markdown-2.2.0-extension-api.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildArch: noarch
|
||||
BuildRequires: python-devel
|
||||
@ -54,7 +52,6 @@ there are a few known issues.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{srcname}-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
# remove shebangs
|
||||
find markdown -type f -name '*.py' \
|
||||
@ -131,6 +128,9 @@ rm -rf %{buildroot}
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Nov 23 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.1-1
|
||||
- Update to 2.2.1.
|
||||
|
||||
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 2.2.0-3
|
||||
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user