summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bangert <ben@groovie.org>2016-02-21 11:28:05 -0800
committerBen Bangert <ben@groovie.org>2016-02-21 11:28:05 -0800
commitefdf2984516688a3c9ada7981ca4f64d7791682c (patch)
treea56143240647155897107bbf304c6994085860f7
parentae9b86a43a7fabcadcb28dfc5f8eff559b32ec59 (diff)
parent60c0683b5efd3fb1ce20aa0c2f954ee86c5c45e5 (diff)
downloadroutes-efdf2984516688a3c9ada7981ca4f64d7791682c.tar.gz
Merge pull request #59 from webknjaz/38-add-webob-dependency
Fix #38: Add webob dependency [optional]
-rw-r--r--.gitignore2
-rw-r--r--CHANGELOG.rst2
-rw-r--r--docs/modules/middleware.rst1
-rw-r--r--routes/middleware.py7
-rw-r--r--setup.py5
-rw-r--r--tox.ini18
6 files changed, 22 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 3f925d7..91c5773 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@ html_coverage
.idea
*.iml
.tox/
+.eggs/
+.coverage
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 5f2d915..2a8a322 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -3,6 +3,8 @@ Routes Changelog
Release 2.3 (**dev**)
=====================
+* Add support for the ``middleware`` extra requirement, making possible to
+ depend on ``webob`` optionally. PR #59. Patch by Sviatoslav Sydorenko.
* 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
diff --git a/docs/modules/middleware.rst b/docs/modules/middleware.rst
index eef80a8..9b12e79 100644
--- a/docs/modules/middleware.rst
+++ b/docs/modules/middleware.rst
@@ -2,7 +2,6 @@
==================================================
.. automodule:: routes.middleware
-.. currentmodule:: routes.middleware
Module Contents
---------------
diff --git a/routes/middleware.py b/routes/middleware.py
index 850e06e..885b9d9 100644
--- a/routes/middleware.py
+++ b/routes/middleware.py
@@ -12,7 +12,12 @@ log = logging.getLogger('routes.middleware')
class RoutesMiddleware(object):
"""Routing middleware that handles resolving the PATH_INFO in
- addition to optionally recognizing method overriding."""
+ addition to optionally recognizing method overriding.
+
+ .. Note::
+ This module requires webob to be installed. To depend on it, you may
+ list routes[middleware] in your ``requirements.txt``
+ """
def __init__(self, wsgi_app, mapper, use_method_override=True,
path_info=True, singleton=True):
"""Create a Route middleware object
diff --git a/setup.py b/setup.py
index 4c64f6e..c3be076 100644
--- a/setup.py
+++ b/setup.py
@@ -57,5 +57,10 @@ setup(name="Routes",
"six",
"repoze.lru>=0.3"
],
+ extras_require={
+ 'middleware': [
+ 'webob',
+ ]
+ },
**extra_options
)
diff --git a/tox.ini b/tox.ini
index 2c2419f..2904df6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,17 +1,13 @@
[tox]
-envlist = py26,py27,py33,py34,pypy,pypy3
+envlist = py26,py27,py33,py34,py35,pypy,pypy3
[testenv]
deps=
- coverage
- nose
- webob
- webtest
+ nose # Adds nosetests command to setup.py
commands=
- python -bb -m nose tests {posargs}
+ python -bb setup.py nosetests {posargs:--with-coverage}
-[testenv:py26]
-# Ony Python 2.6, python -m test doesn't work. Anyway, python -bb is only
-# interested on Python 3.
-commands=
- nosetests tests {posargs}
+ # We could to this in dependencies, but explicit is better than implicit
+ pip install .[middleware]
+ # webob optional dependency is fulfilled by [middleware] extra requirement
+ python -c "import webob"