[Python-modules-commits] [python-tornado] 01/10: Import python-tornado_4.4.1.orig.tar.gz
Ondřej Nový
onovy at moszumanska.debian.org
Mon Aug 1 09:29:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
onovy pushed a commit to branch master
in repository python-tornado.
commit 78b250c7a19799d2e1ccf68f36725ea2f61bff7b
Author: Ondřej Nový <onovy at debian.org>
Date: Mon Aug 1 11:14:21 2016 +0200
Import python-tornado_4.4.1.orig.tar.gz
---
docs/releases.rst | 1 +
docs/releases/v4.4.1.rst | 12 ++++++++++++
setup.py | 2 +-
tornado/__init__.py | 4 ++--
tornado/test/web_test.py | 23 +++++++++++++++++++++++
tornado/web.py | 8 +++++---
6 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/docs/releases.rst b/docs/releases.rst
index cb2c026..f61d1cc 100644
--- a/docs/releases.rst
+++ b/docs/releases.rst
@@ -4,6 +4,7 @@ Release notes
.. toctree::
:maxdepth: 2
+ releases/v4.4.1
releases/v4.4.0
releases/v4.3.0
releases/v4.2.1
diff --git a/docs/releases/v4.4.1.rst b/docs/releases/v4.4.1.rst
new file mode 100644
index 0000000..b63ce15
--- /dev/null
+++ b/docs/releases/v4.4.1.rst
@@ -0,0 +1,12 @@
+What's new in Tornado 4.4.1
+===========================
+
+Jul 23, 2016
+------------
+
+`tornado.web`
+~~~~~~~~~~~~~
+
+* Fixed a regression in Tornado 4.4 which caused URL regexes
+ containing backslash escapes outside capturing groups to be
+ rejected.
diff --git a/setup.py b/setup.py
index 836c363..9eddaef 100644
--- a/setup.py
+++ b/setup.py
@@ -103,7 +103,7 @@ http://api.mongodb.org/python/current/installation.html#osx
kwargs = {}
-version = "4.4"
+version = "4.4.1"
with open('README.rst') as f:
kwargs['long_description'] = f.read()
diff --git a/tornado/__init__.py b/tornado/__init__.py
index 140d171..9778f65 100644
--- a/tornado/__init__.py
+++ b/tornado/__init__.py
@@ -25,5 +25,5 @@ from __future__ import absolute_import, division, print_function, with_statement
# is zero for an official release, positive for a development branch,
# or negative for a release candidate or beta (after the base version
# number has been incremented)
-version = "4.4"
-version_info = (4, 4, 0, 0)
+version = "4.4.1"
+version_info = (4, 4, 1, 0)
diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
index 745d0fa..fdd1797 100644
--- a/tornado/test/web_test.py
+++ b/tornado/test/web_test.py
@@ -2811,3 +2811,26 @@ class ApplicationTest(AsyncTestCase):
class URLSpecReverseTest(unittest.TestCase):
def test_reverse(self):
self.assertEqual('/favicon.ico', url(r'/favicon\.ico', None).reverse())
+ self.assertEqual('/favicon.ico', url(r'^/favicon\.ico$', None).reverse())
+
+ def test_non_reversible(self):
+ # URLSpecs are non-reversible if they include non-constant
+ # regex features outside capturing groups. Currently, this is
+ # only strictly enforced for backslash-escaped character
+ # classes.
+ paths = [
+ r'^/api/v\d+/foo/(\w+)$',
+ ]
+ for path in paths:
+ # A URLSpec can still be created even if it cannot be reversed.
+ url_spec = url(path, None)
+ try:
+ result = url_spec.reverse()
+ self.fail("did not get expected exception when reversing %s. "
+ "result: %s" % (path, result))
+ except ValueError:
+ pass
+
+ def test_reverse_arguments(self):
+ self.assertEqual('/api/v1/foo/bar',
+ url(r'^/api/v1/foo/(\w+)$', None).reverse('bar'))
diff --git a/tornado/web.py b/tornado/web.py
index 479dd24..f54c4d0 100644
--- a/tornado/web.py
+++ b/tornado/web.py
@@ -3059,14 +3059,16 @@ class URLSpec(object):
try:
unescaped_fragment = re_unescape(fragment)
except ValueError as exc:
- raise ValueError(exc.args[0] + '; invalid url: %r' % pattern)
+ # If we can't unescape part of it, we can't
+ # reverse this url.
+ return (None, None)
pieces.append(unescaped_fragment)
return (''.join(pieces), self.regex.groups)
def reverse(self, *args):
- assert self._path is not None, \
- "Cannot reverse url regex " + self.regex.pattern
+ if self._path is None:
+ raise ValueError("Cannot reverse url regex " + self.regex.pattern)
assert len(args) == self._group_count, "required number of arguments "\
"not found"
if not len(args):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-tornado.git
More information about the Python-modules-commits
mailing list