[Python-modules-commits] [python-aiohttp] 01/03: Import python-aiohttp_1.1.2.orig.tar.gz
Piotr Ożarowski
piotr at moszumanska.debian.org
Tue Nov 8 22:04:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
piotr pushed a commit to branch master
in repository python-aiohttp.
commit a7eb6ae099efc97dc438674bf440a42fe2ab2a6a
Author: Piotr Ożarowski <piotr at debian.org>
Date: Tue Nov 8 22:58:34 2016 +0100
Import python-aiohttp_1.1.2.orig.tar.gz
---
CHANGES.rst | 11 +++++++++++
PKG-INFO | 13 ++++++++++++-
aiohttp.egg-info/PKG-INFO | 13 ++++++++++++-
aiohttp/__init__.py | 2 +-
aiohttp/helpers.py | 8 ++++++++
aiohttp/web.py | 2 --
aiohttp/web_urldispatcher.py | 9 ++++++---
aiohttp/worker.py | 10 ++++++++--
docs/spelling_wordlist.txt | 1 +
docs/tutorial.rst | 4 ++--
tests/test_helpers.py | 10 ++++++++++
tests/test_urldispatch.py | 5 +++++
tests/test_worker.py | 39 +++++++++++++++++++++++++++++++++++++++
13 files changed, 115 insertions(+), 12 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 70f9f0b..15c8fdd 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,17 @@
CHANGES
=======
+1.1.2 (2016-11-08)
+------------------
+
+- Allow starting variables with an underscore #1379
+
+- Properly process UNIX sockets by gunicorn worker #1375
+
+- Fix ordering for `FrozenList`
+
+- Don't propagate pre and post signals to sub-application #1377
+
1.1.1 (2016-11-04)
------------------
diff --git a/PKG-INFO b/PKG-INFO
index a2e71f9..7667c2e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: aiohttp
-Version: 1.1.1
+Version: 1.1.2
Summary: http client/server for asyncio
Home-page: https://github.com/KeepSafe/aiohttp/
Author: Andrew Svetlov
@@ -161,6 +161,17 @@ Description: http client/server for asyncio
CHANGES
=======
+ 1.1.2 (2016-11-08)
+ ------------------
+
+ - Allow starting variables with an underscore #1379
+
+ - Properly process UNIX sockets by gunicorn worker #1375
+
+ - Fix ordering for `FrozenList`
+
+ - Don't propagate pre and post signals to sub-application #1377
+
1.1.1 (2016-11-04)
------------------
diff --git a/aiohttp.egg-info/PKG-INFO b/aiohttp.egg-info/PKG-INFO
index a2e71f9..7667c2e 100644
--- a/aiohttp.egg-info/PKG-INFO
+++ b/aiohttp.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: aiohttp
-Version: 1.1.1
+Version: 1.1.2
Summary: http client/server for asyncio
Home-page: https://github.com/KeepSafe/aiohttp/
Author: Andrew Svetlov
@@ -161,6 +161,17 @@ Description: http client/server for asyncio
CHANGES
=======
+ 1.1.2 (2016-11-08)
+ ------------------
+
+ - Allow starting variables with an underscore #1379
+
+ - Properly process UNIX sockets by gunicorn worker #1375
+
+ - Fix ordering for `FrozenList`
+
+ - Don't propagate pre and post signals to sub-application #1377
+
1.1.1 (2016-11-04)
------------------
diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py
index ce884a3..51d6f1b 100644
--- a/aiohttp/__init__.py
+++ b/aiohttp/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '1.1.1'
+__version__ = '1.1.2'
# Deprecated, keep it here for a while for backward compatibility.
import multidict # noqa
diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py
index 53d155e..2f8bac3 100644
--- a/aiohttp/helpers.py
+++ b/aiohttp/helpers.py
@@ -11,6 +11,7 @@ import os
import re
import warnings
from collections import MutableSequence, namedtuple
+from functools import total_ordering
from pathlib import Path
from time import gmtime, time
from urllib.parse import urlencode
@@ -532,6 +533,7 @@ def _get_kwarg(kwargs, old, new, value):
return value
+ at total_ordering
class FrozenList(MutableSequence):
__slots__ = ('_frozen', '_items')
@@ -569,6 +571,12 @@ class FrozenList(MutableSequence):
def __reversed__(self):
return self._items.__reversed__()
+ def __eq__(self, other):
+ return list(self) == other
+
+ def __le__(self, other):
+ return list(self) <= other
+
def insert(self, pos, item):
if self._frozen:
raise RuntimeError("Cannot modify frozen list.")
diff --git a/aiohttp/web.py b/aiohttp/web.py
index 3d76bab..f80ba0c 100644
--- a/aiohttp/web.py
+++ b/aiohttp/web.py
@@ -259,8 +259,6 @@ class Application(MutableMapping):
appsig = getattr(self, signame)
appsig.append(handler)
- reg_handler('on_pre_signal')
- reg_handler('on_post_signal')
reg_handler('on_startup')
reg_handler('on_shutdown')
reg_handler('on_cleanup')
diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py
index a701156..aa644b9 100644
--- a/aiohttp/web_urldispatcher.py
+++ b/aiohttp/web_urldispatcher.py
@@ -273,6 +273,8 @@ class Resource(AbstractResource):
else:
return None, allowed_methods
+ yield # pragma: no cover
+
def __len__(self):
return len(self._routes)
@@ -441,6 +443,7 @@ class StaticResource(PrefixResource):
match_dict = {'filename': unquote(path[self._prefix_len:])}
return (UrlMappingMatchInfo(match_dict, self._routes[method]),
allowed_methods)
+ yield # pragma: no cover
def __len__(self):
return len(self._routes)
@@ -694,12 +697,12 @@ class RoutesView(Sized, Iterable, Container):
class UrlDispatcher(AbstractRouter, collections.abc.Mapping):
- DYN = re.compile(r'\{(?P<var>[a-zA-Z][_a-zA-Z0-9]*)\}')
+ DYN = re.compile(r'\{(?P<var>[_a-zA-Z][_a-zA-Z0-9]*)\}')
DYN_WITH_RE = re.compile(
- r'\{(?P<var>[a-zA-Z][_a-zA-Z0-9]*):(?P<re>.+)\}')
+ r'\{(?P<var>[_a-zA-Z][_a-zA-Z0-9]*):(?P<re>.+)\}')
GOOD = r'[^{}/]+'
ROUTE_RE = re.compile(r'(\{[_a-zA-Z][^{}]*(?:\{[^{}]*\}[^{}]*)*\})')
- NAME_SPLIT_RE = re.compile('[.:-]')
+ NAME_SPLIT_RE = re.compile(r'[.:-]')
def __init__(self, app):
super().__init__()
diff --git a/aiohttp/worker.py b/aiohttp/worker.py
index 9d079cc..94a9c44 100644
--- a/aiohttp/worker.py
+++ b/aiohttp/worker.py
@@ -4,6 +4,7 @@ import asyncio
import os
import re
import signal
+import socket
import ssl
import sys
@@ -88,8 +89,13 @@ class GunicornWebWorker(base.Worker):
for sock in self.sockets:
handler = self.make_handler(self.wsgi)
- srv = yield from self.loop.create_server(handler, sock=sock.sock,
- ssl=ctx)
+
+ if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX:
+ srv = yield from self.loop.create_unix_server(
+ handler, sock=sock.sock, ssl=ctx)
+ else:
+ srv = yield from self.loop.create_server(
+ handler, sock=sock.sock, ssl=ctx)
self.servers[srv] = handler
# If our parent changed then we shut down.
diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt
index 3082987..91f43b1 100644
--- a/docs/spelling_wordlist.txt
+++ b/docs/spelling_wordlist.txt
@@ -166,6 +166,7 @@ requote
resolvers
reusage
sa
+schemas
sendfile
serializable
shourtcuts
diff --git a/docs/tutorial.rst b/docs/tutorial.rst
index 829f1ff..1a51a29 100644
--- a/docs/tutorial.rst
+++ b/docs/tutorial.rst
@@ -148,13 +148,13 @@ Database
Setup
^^^^^
-In this tutorial we use latest PostgreSQL database. You can install
+In this tutorial we will use the latest PostgreSQL database. You can install
PostgreSQL using this instruction http://www.postgresql.org/download/
Database schema
^^^^^^^^^^^^^^^
-We use SQLAlchemy for describe database schema.
+We use SQLAlchemy to describe database schemas.
For this tutorial we can use two simple models ``question`` and ``choice``::
import sqlalchemy as sa
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 57ad6e7..a68cd90 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -422,3 +422,13 @@ class TestTimeService:
assert time_service._strtime is None
assert time_service._count == 0
assert time_service._time > 1234
+
+
+class TestFrozenList:
+ def test_eq(self):
+ l = helpers.FrozenList([1])
+ assert l == [1]
+
+ def test_le(self):
+ l = helpers.FrozenList([1])
+ assert l < [2]
diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py
index 8f12fcb..825c3be 100644
--- a/tests/test_urldispatch.py
+++ b/tests/test_urldispatch.py
@@ -984,3 +984,8 @@ def test_set_options_route(router):
with pytest.raises(RuntimeError):
resource.set_options_route(make_handler())
+
+
+def test_dynamic_url_with_name_started_from_undescore(router):
+ route = router.add_route('GET', '/get/{_name}', make_handler())
+ assert URL('/get/John') == route.url_for(_name='John')
diff --git a/tests/test_worker.py b/tests/test_worker.py
index 944262d..315f314 100644
--- a/tests/test_worker.py
+++ b/tests/test_worker.py
@@ -1,6 +1,7 @@
"""Tests for aiohttp/worker.py"""
import asyncio
import pathlib
+import socket
import ssl
from unittest import mock
@@ -157,6 +158,44 @@ def test__run_ok(worker, loop):
assert ctx is ssl_context
+ at pytest.mark.skipif(not hasattr(socket, 'AF_UNIX'),
+ reason="UNIX sockets are not supported")
+ at asyncio.coroutine
+def test__run_ok_unix_socket(worker, loop):
+ worker.ppid = 1
+ worker.alive = True
+ worker.servers = {}
+ sock = mock.Mock()
+ sock.cfg_addr = ('/path/to')
+ sock.family = socket.AF_UNIX
+ worker.sockets = [sock]
+ worker.wsgi = mock.Mock()
+ worker.close = make_mocked_coro(None)
+ worker.log = mock.Mock()
+ worker.loop = loop
+ loop.create_unix_server = make_mocked_coro(sock)
+ worker.wsgi.make_handler.return_value.requests_count = 1
+ worker.cfg.max_requests = 100
+ worker.cfg.is_ssl = True
+ worker.cfg.access_log_format = ACCEPTABLE_LOG_FORMAT
+
+ ssl_context = mock.Mock()
+ with mock.patch('ssl.SSLContext', return_value=ssl_context):
+ with mock.patch('aiohttp.worker.asyncio') as m_asyncio:
+ m_asyncio.sleep = mock.Mock(
+ wraps=asyncio.coroutine(lambda *a, **kw: None))
+ yield from worker._run()
+
+ worker.notify.assert_called_with()
+ worker.log.info.assert_called_with("Parent changed, shutting down: %s",
+ worker)
+
+ args, kwargs = loop.create_unix_server.call_args
+ assert 'ssl' in kwargs
+ ctx = kwargs['ssl']
+ assert ctx is ssl_context
+
+
@asyncio.coroutine
def test__run_exc(worker, loop):
with mock.patch('aiohttp.worker.os') as m_os:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-aiohttp.git
More information about the Python-modules-commits
mailing list