summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-19 17:22:44 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-19 17:22:44 +0100
commit4e459477500595f36c0ed7919e04d61167c5d737 (patch)
treebd458eb43fe6221276cb33cd246dd8c46d878aef
parent1a281a576d1857f481e801e525d38477309c8f18 (diff)
downloadapifw-4e459477500595f36c0ed7919e04d61167c5d737.tar.gz
Fix: unify scope checking
Previously, there were two ways of checking if the scope was needed. They differed.
-rw-r--r--apifw/bottleapp.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/apifw/bottleapp.py b/apifw/bottleapp.py
index ab92f3c..20e57ef 100644
--- a/apifw/bottleapp.py
+++ b/apifw/bottleapp.py
@@ -102,10 +102,9 @@ class BottleAuthorizationPlugin:
# bottle.Route object.
method = route.get('method', 'GET')
path = route.get('path')
- if not path:
- rule = route.get('rule')
- path = re.sub(r'/<[^>]+>', '', rule)
- return (method, path)
+ rule = route.get('rule')
+ scope = self.get_scope_for_route(method, path or rule)
+ return (method, scope)
def apply(self, callback, route):
def wrapper(*args, **kwargs):