Hello community,
here is the log from the commit of package python-Routes for openSUSE:Factory checked in at 2016-06-07 23:49:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Routes (Old)
and /work/SRC/openSUSE:Factory/.python-Routes.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Routes"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Routes/python-Routes.changes 2015-08-10 09:16:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-Routes.new/python-Routes.changes 2016-06-07 23:49:24.000000000 +0200
@@ -1,0 +2,20 @@
+Fri Jun 3 15:51:22 UTC 2016 - tbechtold@suse.com
+
+- update to 2.3.1:
+ * Backwards compatability fix - connect should work with mandatory
+ routename and optional path. Patch by Davanum Srinivas (PR #65).
+ * Fix sub_domain equivalence check. Patch by Nikita Uvarov
+ * Add support for protocol-relative URLs generation (i.e. starting with double
+ slash ``//``). PR #60. Patch by Sviatoslav Sydorenko.
+ * 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
+ 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
+ through when using submappers. PR #28.
+
+-------------------------------------------------------------------
Old:
----
Routes-2.2.tar.gz
New:
----
Routes-2.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Routes.spec ++++++
--- /var/tmp/diff_new_pack.UgwVJN/_old 2016-06-07 23:49:25.000000000 +0200
+++ /var/tmp/diff_new_pack.UgwVJN/_new 2016-06-07 23:49:25.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-Routes
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: python-Routes
-Version: 2.2
+Version: 2.3.1
Release: 0
Url: http://routes.groovie.org/
Summary: Routing Recognition and Generation Tools
++++++ Routes-2.2.tar.gz -> Routes-2.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/CHANGELOG.rst new/Routes-2.3.1/CHANGELOG.rst
--- old/Routes-2.2/CHANGELOG.rst 2015-07-22 06:42:41.000000000 +0200
+++ new/Routes-2.3.1/CHANGELOG.rst 2016-03-30 16:58:46.000000000 +0200
@@ -1,6 +1,27 @@
Routes Changelog
%%%%%%%%%%%%%%%%
+Release 2.3.1 (March 30, 2016)
+==============================
+* Backwards compatability fix - connect should work with mandatory
+ routename and optional path. Patch by Davanum Srinivas (PR #65).
+
+Release 2.3 (March 28, 2016)
+============================
+* Fix sub_domain equivalence check. Patch by Nikita Uvarov
+* Add support for protocol-relative URLs generation (i.e. starting with double
+ slash ``//``). PR #60. Patch by Sviatoslav Sydorenko.
+* 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
+ 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
+ through when using submappers. PR #28.
+
Release 2.2 (July 21, 2015)
===========================
* Fix Python 3 support. Patch by Victor Stinner.
@@ -418,7 +439,7 @@
Or::
- from routes import request_confg, Mapper
+ from routes import request_config, Mapper
The following names are available for importing from routes::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/LICENSE.txt new/Routes-2.3.1/LICENSE.txt
--- old/Routes-2.2/LICENSE.txt 2015-07-22 06:40:34.000000000 +0200
+++ new/Routes-2.3.1/LICENSE.txt 2016-03-30 16:54:49.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (c) 2005-2015 Ben Bangert
+Copyright (c) 2005-2016 Ben Bangert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/PKG-INFO new/Routes-2.3.1/PKG-INFO
--- old/Routes-2.2/PKG-INFO 2015-07-22 06:44:43.000000000 +0200
+++ new/Routes-2.3.1/PKG-INFO 2016-03-30 17:02:17.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Routes
-Version: 2.2
+Version: 2.3.1
Summary: Routing Recognition and Generation Tools
Home-page: http://routes.readthedocs.org/
Author: Ben Bangert
@@ -24,6 +24,27 @@
Routes Changelog
%%%%%%%%%%%%%%%%
+ Release 2.3.1 (March 30, 2016)
+ ==============================
+ * Backwards compatability fix - connect should work with mandatory
+ routename and optional path. Patch by Davanum Srinivas (PR #65).
+
+ Release 2.3 (March 28, 2016)
+ ============================
+ * Fix sub_domain equivalence check. Patch by Nikita Uvarov
+ * Add support for protocol-relative URLs generation (i.e. starting with double
+ slash ``//``). PR #60. Patch by Sviatoslav Sydorenko.
+ * 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
+ 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
+ through when using submappers. PR #28.
+
Release 2.2 (July 21, 2015)
===========================
* Fix Python 3 support. Patch by Victor Stinner.
@@ -441,7 +462,7 @@
Or::
- from routes import request_confg, Mapper
+ from routes import request_config, Mapper
The following names are available for importing from routes::
@@ -483,3 +504,4 @@
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/Routes.egg-info/PKG-INFO new/Routes-2.3.1/Routes.egg-info/PKG-INFO
--- old/Routes-2.2/Routes.egg-info/PKG-INFO 2015-07-22 06:44:43.000000000 +0200
+++ new/Routes-2.3.1/Routes.egg-info/PKG-INFO 2016-03-30 17:02:17.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Routes
-Version: 2.2
+Version: 2.3.1
Summary: Routing Recognition and Generation Tools
Home-page: http://routes.readthedocs.org/
Author: Ben Bangert
@@ -24,6 +24,27 @@
Routes Changelog
%%%%%%%%%%%%%%%%
+ Release 2.3.1 (March 30, 2016)
+ ==============================
+ * Backwards compatability fix - connect should work with mandatory
+ routename and optional path. Patch by Davanum Srinivas (PR #65).
+
+ Release 2.3 (March 28, 2016)
+ ============================
+ * Fix sub_domain equivalence check. Patch by Nikita Uvarov
+ * Add support for protocol-relative URLs generation (i.e. starting with double
+ slash ``//``). PR #60. Patch by Sviatoslav Sydorenko.
+ * 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
+ 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
+ through when using submappers. PR #28.
+
Release 2.2 (July 21, 2015)
===========================
* Fix Python 3 support. Patch by Victor Stinner.
@@ -441,7 +462,7 @@
Or::
- from routes import request_confg, Mapper
+ from routes import request_config, Mapper
The following names are available for importing from routes::
@@ -483,3 +504,4 @@
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/Routes.egg-info/requires.txt new/Routes-2.3.1/Routes.egg-info/requires.txt
--- old/Routes-2.2/Routes.egg-info/requires.txt 2015-07-22 06:44:43.000000000 +0200
+++ new/Routes-2.3.1/Routes.egg-info/requires.txt 2016-03-30 17:02:17.000000000 +0200
@@ -1,2 +1,5 @@
six
-repoze.lru>=0.3
\ No newline at end of file
+repoze.lru>=0.3
+
+[middleware]
+webob
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/docs/conf.py new/Routes-2.3.1/docs/conf.py
--- old/Routes-2.2/docs/conf.py 2015-07-22 06:41:30.000000000 +0200
+++ new/Routes-2.3.1/docs/conf.py 2016-03-30 16:54:28.000000000 +0200
@@ -36,15 +36,15 @@
# General substitutions.
project = 'Routes'
-copyright = '2005-2015, Ben Bangert, Mike Orr'
+copyright = '2005-2016, Ben Bangert, Mike Orr, and numerous contributers'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
-version = '1.13'
+version = '2.3'
# The full version, including alpha/beta/rc tags.
-release = '1.13'
+release = '2.3.1'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/docs/modules/middleware.rst new/Routes-2.3.1/docs/modules/middleware.rst
--- old/Routes-2.2/docs/modules/middleware.rst 2015-01-17 19:44:57.000000000 +0100
+++ new/Routes-2.3.1/docs/modules/middleware.rst 2016-03-28 17:36:53.000000000 +0200
@@ -2,7 +2,6 @@
==================================================
.. automodule:: routes.middleware
-.. currentmodule:: routes.middleware
Module Contents
---------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/routes/mapper.py new/Routes-2.3.1/routes/mapper.py
--- old/Routes-2.2/routes/mapper.py 2015-07-22 06:40:34.000000000 +0200
+++ new/Routes-2.3.1/routes/mapper.py 2016-03-30 16:52:54.000000000 +0200
@@ -116,7 +116,19 @@
controller = resource_name or collection_name
if path_prefix is None:
- path_prefix = '/' + collection_name
+ if collection_name is None:
+ path_prefix_str = ''
+ else:
+ path_prefix_str = '/{collection_name}'
+ else:
+ if collection_name is None:
+ path_prefix_str = "{pre}"
+ else:
+ path_prefix_str = "{pre}/{collection_name}"
+
+ # generate what will be the path prefix for the collection
+ path_prefix = path_prefix_str.format(pre=path_prefix,
+ collection_name=collection_name)
collection = SubMapper(self, collection_name=collection_name,
resource_name=resource_name,
@@ -148,30 +160,44 @@
self.formatted = getattr(obj, 'formatted', None)
if self.formatted is None:
self.formatted = True
+ self.add_actions(actions or [], **kwargs)
- self.add_actions(actions or [])
-
- def connect(self, *args, **kwargs):
+ def connect(self, routename, path=None, **kwargs):
newkargs = {}
- newargs = args
+ _routename = routename
+ _path = path
for key, value in six.iteritems(self.kwargs):
if key == 'path_prefix':
- if len(args) > 1:
- newargs = (args[0], self.kwargs[key] + args[1])
+ if path is not None:
+ # if there's a name_prefix, add it to the route name
+ # and if there's a path_prefix
+ _path = ''.join((self.kwargs[key], path))
+ else:
+ _path = ''.join((self.kwargs[key], routename))
+ elif key == 'name_prefix':
+ if path is not None:
+ # if there's a name_prefix, add it to the route name
+ # and if there's a path_prefix
+ _routename = ''.join((self.kwargs[key], routename))
else:
- newargs = (self.kwargs[key] + args[0],)
+ _routename = None
elif key in kwargs:
if isinstance(value, dict):
newkargs[key] = dict(value, **kwargs[key]) # merge dicts
- elif key == 'controller':
- newkargs[key] = kwargs[key]
else:
- newkargs[key] = value + kwargs[key]
+ # Originally used this form:
+ # newkargs[key] = value + kwargs[key]
+ # New version avoids the inheritance concatenation issue
+ # with submappers. Only prefixes concatenate, everything
+ # else overrides in submappers.
+ newkargs[key] = kwargs[key]
else:
newkargs[key] = self.kwargs[key]
for key in kwargs:
if key not in self.kwargs:
newkargs[key] = kwargs[key]
+
+ newargs = (_routename, _path)
return self.obj.connect(*newargs, **newkargs)
def link(self, rel=None, name=None, action=None, method='GET',
@@ -263,8 +289,8 @@
"""Generates the "delete" action for a collection member submapper."""
return self.action(action='delete', method='DELETE', **kwargs)
- def add_actions(self, actions):
- [getattr(self, action)() for action in actions]
+ def add_actions(self, actions, **kwargs):
+ [getattr(self, action)(**kwargs) for action in actions]
# Provided for those who prefer using the 'with' syntax in Python 2.5+
def __enter__(self):
@@ -687,10 +713,10 @@
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)
@@ -711,10 +737,10 @@
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:
@@ -763,7 +789,11 @@
six.text_type(kargs).encode('utf8')
if self.urlcache is not None:
- cache_key_script_name = '%s:%s' % (script_name, cache_key)
+ if six.PY3:
+ cache_key_script_name = b':'.join((script_name.encode('utf-8'),
+ cache_key))
+ else:
+ cache_key_script_name = '%s:%s' % (script_name, cache_key)
# Check the url cache to see if it exists, use it if it does
val = self.urlcache.get(cache_key_script_name, self)
@@ -956,6 +986,22 @@
# GET /category/7/message/1
# has named route "category_message"
+ ``requirements``
+
+ A dictionary that restricts the matching of a
+ variable. Can be used when matching variables with path_prefix.
+
+ Example::
+
+ map.resource('message', 'messages',
+ path_prefix='{project_id}/',
+ requirements={"project_id": R"\d+"})
+ # POST /01234/message
+ # success, project_id is set to "01234"
+ # POST /foo/message
+ # 404 not found, won't be matched by this route
+
+
``parent_resource``
A ``dict`` containing information about the parent
resource, for creating a nested resource. It should contain
@@ -1079,6 +1125,8 @@
'_parent_resource': parent_resource,
'_filter': kwargs.get('_filter')
}
+ if 'requirements' in kwargs:
+ options['requirements'] = kwargs['requirements']
def requirements_for(meth):
"""Returns a new dict to be used for all route creation as the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/routes/middleware.py new/Routes-2.3.1/routes/middleware.py
--- old/Routes-2.2/routes/middleware.py 2015-01-17 19:20:18.000000000 +0100
+++ new/Routes-2.3.1/routes/middleware.py 2016-03-28 17:36:53.000000000 +0200
@@ -12,7 +12,12 @@
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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/routes/util.py new/Routes-2.3.1/routes/util.py
--- old/Routes-2.2/routes/util.py 2015-07-22 06:40:34.000000000 +0200
+++ new/Routes-2.3.1/routes/util.py 2016-03-28 17:36:53.000000000 +0200
@@ -93,10 +93,12 @@
port = ''
if len(hostmatch) > 1:
port += ':' + hostmatch[1]
- sub_match = re.compile('^.+?\.(%s)$' % mapper.domain_match)
- domain = re.sub(sub_match, r'\1', host)
+
+ match = re.match('^(.+?)\.(%s)$' % mapper.domain_match, host)
+ host_subdomain, domain = match.groups() if match else (None, host)
+
subdomain = as_unicode(subdomain, mapper.encoding)
- if subdomain and not host.startswith(subdomain) and \
+ if subdomain and host_subdomain != subdomain and \
subdomain not in mapper.sub_domains_ignore:
kargs['_host'] = subdomain + '.' + domain + port
elif (subdomain in mapper.sub_domains_ignore or \
@@ -180,15 +182,19 @@
"""
anchor = kargs.get('anchor')
host = kargs.get('host')
- protocol = kargs.get('protocol')
+ protocol = kargs.pop('protocol', None)
qualified = kargs.pop('qualified', None)
# Remove special words from kargs, convert placeholders
- for key in ['anchor', 'host', 'protocol']:
+ for key in ['anchor', 'host']:
if kargs.get(key):
del kargs[key]
if key+'_' in kargs:
kargs[key] = kargs.pop(key+'_')
+
+ if 'protocol_' in kargs:
+ kargs['protocol_'] = protocol
+
config = request_config()
route = None
static = False
@@ -250,21 +256,23 @@
newargs = _screenargs(kargs, config.mapper, environ)
anchor = newargs.pop('_anchor', None) or anchor
host = newargs.pop('_host', None) or host
- protocol = newargs.pop('_protocol', None) or protocol
+ protocol = newargs.pop('_protocol', protocol)
url = config.mapper.generate(*route_args, **newargs)
if anchor is not None:
url += '#' + _url_quote(anchor, encoding)
- if host or protocol or qualified:
+ if host or (protocol is not None) or qualified:
if not host and not qualified:
# Ensure we don't use a specific port, as changing the protocol
# means that we most likely need a new port
host = config.host.split(':')[0]
elif not host:
host = config.host
- if not protocol:
+ if protocol is None:
protocol = config.protocol
+ if protocol != '':
+ protocol += ':'
if url is not None:
- url = protocol + '://' + host + url
+ url = protocol + '//' + host + url
if not ascii_characters(url) and url is not None:
raise GenerationException("url_for can only return a string, got "
@@ -324,16 +332,19 @@
"""
anchor = kargs.get('anchor')
host = kargs.get('host')
- protocol = kargs.get('protocol')
+ protocol = kargs.pop('protocol', None)
qualified = kargs.pop('qualified', None)
# Remove special words from kargs, convert placeholders
- for key in ['anchor', 'host', 'protocol']:
+ for key in ['anchor', 'host']:
if kargs.get(key):
del kargs[key]
if key+'_' in kargs:
kargs[key] = kargs.pop(key+'_')
+ if 'protocol_' in kargs:
+ kargs['protocol_'] = protocol
+
route = None
use_current = '_use_current' in kargs and kargs.pop('_use_current')
@@ -396,12 +407,13 @@
anchor = anchor or newargs.pop('_anchor', None)
host = host or newargs.pop('_host', None)
- protocol = protocol or newargs.pop('_protocol', None)
+ if protocol is None:
+ protocol = newargs.pop('_protocol', None)
newargs['_environ'] = self.environ
url = self.mapper.generate(*route_args, **newargs)
if anchor is not None:
url += '#' + _url_quote(anchor, encoding)
- if host or protocol or qualified:
+ if host or (protocol is not None) or qualified:
if 'routes.cached_hostinfo' not in self.environ:
cache_hostinfo(self.environ)
hostinfo = self.environ['routes.cached_hostinfo']
@@ -412,12 +424,14 @@
host = hostinfo['host'].split(':')[0]
elif not host:
host = hostinfo['host']
- if not protocol:
+ if protocol is None:
protocol = hostinfo['protocol']
+ if protocol != '':
+ protocol += ':'
if url is not None:
if host[-1] != '/':
host += '/'
- url = protocol + '://' + host + url.lstrip('/')
+ url = protocol + '//' + host + url.lstrip('/')
if not ascii_characters(url) and url is not None:
raise GenerationException("Can only return a string, got "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Routes-2.2/setup.py new/Routes-2.3.1/setup.py
--- old/Routes-2.2/setup.py 2015-07-22 06:42:53.000000000 +0200
+++ new/Routes-2.3.1/setup.py 2016-03-30 16:53:35.000000000 +0200
@@ -1,4 +1,4 @@
-__version__ = '2.2'
+__version__ = '2.3.1'
import io
import os
@@ -41,7 +41,8 @@
"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",
@@ -56,5 +57,10 @@
"six",
"repoze.lru>=0.3"
],
+ extras_require={
+ 'middleware': [
+ 'webob',
+ ]
+ },
**extra_options
)