Skip to content

Commit 8b74c70

Browse files
committed
Fixed named middleware overwrite
1 parent ff8c51f commit 8b74c70

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

aiohttp_dynamic/middlewares.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ def add_named_handler(self, middleware: typing.Callable[[web_request.Request, Ha
6363
"""
6464

6565
if name is not None:
66-
for m in self._handlers:
66+
for i, m in enumerate(self._handlers):
6767
if m[0] == name:
6868
if overwrite:
69-
m[1] = middleware
69+
self._handlers[i] = (name, middleware)
7070
return True
7171
else:
7272
return False
@@ -101,9 +101,9 @@ def contains_named_handler(self, name: str) -> bool:
101101
if name is not None:
102102
for m in self._handlers:
103103
if m[0] == name:
104-
return m[1]
104+
return True
105105

106-
return None
106+
return False
107107

108108
def del_handler(self, index: int) -> None:
109109
"""

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
setup(
44
name = 'aiohttp_dynamic',
55
packages = ['aiohttp_dynamic'],
6-
version = '1.1.0',
6+
version = '1.1.1',
77
license='Apache License 2.0',
88
description = 'aiohttp extension for creating and modifying dynamic routes in runtime',
99
author = 'bitrate16',
1010
author_email = 'bitrate16@gmail.com',
1111
url = 'https://github.com/bitrate16/aiohttp-dynamic',
12-
download_url = 'https://github.com/bitrate16/aiohttp-dynamic/archive/1.1.0.tar.gz',
12+
download_url = 'https://github.com/bitrate16/aiohttp-dynamic/archive/1.1.1.tar.gz',
1313
keywords = ['aiohttp', 'dynamic', 'routing', 'mutable', 'aiohttp-server'],
1414
install_requires = [
1515
'aiohttp',
1616
'yarl'
1717
],
1818
classifiers = [
1919
# Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
20-
'Development Status :: 5 - Production/Stable',
20+
'Development Status :: 4 - Beta',
2121
'Intended Audience :: Developers',
2222
'Topic :: Software Development :: Libraries :: Python Modules',
2323
'License :: OSI Approved :: Apache Software License',

0 commit comments

Comments
 (0)