summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bangert <ben@groovie.org>2016-02-03 20:41:17 -0800
committerBen Bangert <ben@groovie.org>2016-02-03 20:41:17 -0800
commite336dc26b9a6b56b2c7492345fc456c6a31dbd80 (patch)
tree08602a4662460e1c804ba2fab61460db18c7aaf2
parentbafc1536f2a354cdb7526a3a40f580885e4dc484 (diff)
parent4d6c0c82a139b449425d85e68c9acd47d5337750 (diff)
downloadroutes-e336dc26b9a6b56b2c7492345fc456c6a31dbd80.tar.gz
Merge pull request #58 from webknjaz/58-fix-empty-string-match
Fix empty string match
-rw-r--r--.travis.yml5
-rw-r--r--CHANGELOG.rst4
-rw-r--r--routes/mapper.py8
-rw-r--r--setup.py3
-rw-r--r--tests/test_functional/test_recognition.py4
5 files changed, 15 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml
index e698e42..e7788ce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,8 +4,13 @@ python:
- "2.7"
- "3.3"
- "3.4"
+ - "3.5"
+ - "nightly"
- "pypy"
- "pypy3"
+matrix:
+ allow_failures:
+ - python: "nightly"
install:
- python setup.py develop
- pip install webob webtest coverage
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 7433724..5f2d915 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -3,10 +3,10 @@ Routes Changelog
Release 2.3 (**dev**)
=====================
-
+* Fix matching of an empty string route, which led to exception in earlier
+ versions. PR #58. Patch by Sviatoslav Sydorenko.
* Add support for the ``requirements`` option when using
mapper.resource to create routes. PR #57. Patch by Sean Dague.
-
* Concatenation fix when using submappers with path prefixes. Multiple
submappers combined the path prefix inside the controller argument in
non-obvious ways. The controller argument will now be properly carried
diff --git a/routes/mapper.py b/routes/mapper.py
index 382c01d..43372d7 100644
--- a/routes/mapper.py
+++ b/routes/mapper.py
@@ -713,10 +713,10 @@ class Mapper(SubMapperParent):
resultdict = m.match('/joe/sixpack')
"""
- if not url and not environ:
+ if url is None and not environ:
raise RoutesException('URL or environ must be provided')
- if not url:
+ if url is None:
url = environ['PATH_INFO']
result = self._match(url, environ)
@@ -737,10 +737,10 @@ class Mapper(SubMapperParent):
resultdict, route_obj = m.match('/joe/sixpack')
"""
- if not url and not environ:
+ if url is None and not environ:
raise RoutesException('URL or environ must be provided')
- if not url:
+ if url is None:
url = environ['PATH_INFO']
result = self._match(url, environ)
if self.debug:
diff --git a/setup.py b/setup.py
index 742c645..4c64f6e 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,8 @@ setup(name="Routes",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
- "Programming Language :: Python :: 3.4"
+ "Programming Language :: Python :: 3.4",
+ "Programming Language :: Python :: 3.5"
],
keywords='routes webob dispatch',
author="Ben Bangert",
diff --git a/tests/test_functional/test_recognition.py b/tests/test_functional/test_recognition.py
index 5e50a60..03fe6a7 100644
--- a/tests/test_functional/test_recognition.py
+++ b/tests/test_functional/test_recognition.py
@@ -913,7 +913,7 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'index','id':None}, m.match('/content'))
eq_({'controller':'content','action':'view','id':'4'}, m.match('/'))
def call_func():
- m.match('')
+ m.match(None)
assert_raises(RoutesException, call_func)
def test_home_noargs(self):
@@ -926,7 +926,7 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/content'))
eq_({}, m.match('/'))
def call_func():
- m.match('')
+ m.match(None)
assert_raises(RoutesException, call_func)
def test_dot_format_args(self):