1
0
mirror of https://github.com/gsi-upm/senpy synced 2026-01-20 06:38:16 +00:00

Added plugins by default and monkey patching

Fixes #2
This commit is contained in:
J. Fernando Sánchez
2015-06-18 17:52:02 +02:00
parent 384aba4654
commit 7c2e0ddec7
12 changed files with 2765 additions and 19 deletions

View File

@@ -18,7 +18,7 @@
Blueprints for Senpy
"""
from flask import Blueprint, request, current_app
from .models import Error, Response
from .models import Error, Response, Leaf
import json
import logging
@@ -158,9 +158,9 @@ def plugins(plugin=None, action="list"):
method = "{}_plugin".format(action)
if(hasattr(sp, method)):
getattr(sp, method)(plugin)
return "Ok"
return Leaf(message="Ok").flask()
else:
return "action '{}' not allowed".format(action), 400
return Error("action '{}' not allowed".format(action)).flask()
if __name__ == '__main__':