From 4e459477500595f36c0ed7919e04d61167c5d737 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 19 Nov 2017 17:22:44 +0100 Subject: Fix: unify scope checking Previously, there were two ways of checking if the scope was needed. They differed. --- apifw/bottleapp.py | 7 +++---- 1 file 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): -- cgit v1.2.1