misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
Simone Margaritelli 2019-10-25 19:38:23 +02:00
parent cf146a54ee
commit 3f785ee06a
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E

View File

@ -168,10 +168,11 @@ class Handler(BaseHTTPRequestHandler):
self._image() self._image()
elif self.path.startswith('/plugins'): elif self.path.startswith('/plugins'):
plugin_from_path = re.match(r'\/plugins\/([^\/]+)(\/.*)?', self.path) matches = re.match(r'\/plugins\/([^\/]+)(\/.*)?', self.path)
if plugin_from_path: if matches:
plugin_name = plugin_from_path.groups()[0] groups = matches.groups()
right_path = plugin_from_path.groups()[1] if len(plugin_from_path.groups()) == 2 else None plugin_name = groups[0]
right_path = groups[1] if len(groups) == 2 else None
plugins.one(plugin_name, 'webhook', right_path) plugins.one(plugin_name, 'webhook', right_path)
else: else: