mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-24 17:12:29 +00:00
Still not functional
This commit is contained in:
parent
aafd6a0938
commit
ecc2a8312a
@ -19,6 +19,7 @@ Blueprints for Senpy
|
|||||||
"""
|
"""
|
||||||
from flask import Blueprint, request, current_app, Flask, redirect, url_for, render_template
|
from flask import Blueprint, request, current_app, Flask, redirect, url_for, render_template
|
||||||
from .models import Error, Response, Leaf
|
from .models import Error, Response, Leaf
|
||||||
|
from future.utils import iteritems
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -58,7 +59,7 @@ def get_params(req, params=BASIC_PARAMS):
|
|||||||
|
|
||||||
outdict = {}
|
outdict = {}
|
||||||
wrong_params = {}
|
wrong_params = {}
|
||||||
for param, options in params.iteritems():
|
for param, options in iteritems(params):
|
||||||
if param[0] != "@": # Exclude json-ld properties
|
if param[0] != "@": # Exclude json-ld properties
|
||||||
logger.debug("Param: %s - Options: %s", param, options)
|
logger.debug("Param: %s - Options: %s", param, options)
|
||||||
for alias in options["aliases"]:
|
for alias in options["aliases"]:
|
||||||
@ -79,7 +80,7 @@ def get_params(req, params=BASIC_PARAMS):
|
|||||||
"message": "Missing or invalid parameters",
|
"message": "Missing or invalid parameters",
|
||||||
"parameters": outdict,
|
"parameters": outdict,
|
||||||
"errors": {param: error for param, error in
|
"errors": {param: error for param, error in
|
||||||
wrong_params.iteritems()}
|
iteritems(wrong_params)}
|
||||||
})
|
})
|
||||||
raise ValueError(message)
|
raise ValueError(message)
|
||||||
return outdict
|
return outdict
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
import gevent
|
import gevent
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_all()
|
monkey.patch_all()
|
||||||
@ -102,7 +104,7 @@ class Senpy(object):
|
|||||||
def default_plugin(self):
|
def default_plugin(self):
|
||||||
candidates = self.filter_plugins(is_activated=True)
|
candidates = self.filter_plugins(is_activated=True)
|
||||||
if len(candidates) > 0:
|
if len(candidates) > 0:
|
||||||
candidate = candidates.values()[0]
|
candidate = list(candidates.values())[0]
|
||||||
logger.debug("Default: {}".format(candidate))
|
logger.debug("Default: {}".format(candidate))
|
||||||
return candidate
|
return candidate
|
||||||
else:
|
else:
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pyld import jsonld
|
from pyld import jsonld
|
||||||
import logging
|
|
||||||
from flask import Response as FlaskResponse
|
from flask import Response as FlaskResponse
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +95,7 @@ class Leaf(dict):
|
|||||||
return contexts
|
return contexts
|
||||||
elif isinstance(context, dict):
|
elif isinstance(context, dict):
|
||||||
return context
|
return context
|
||||||
elif isinstance(context, basestring):
|
elif isinstance(context, str):
|
||||||
try:
|
try:
|
||||||
with open(context) as f:
|
with open(context) as f:
|
||||||
return json.loads(f.read())
|
return json.loads(f.read())
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import os.path
|
import os.path
|
||||||
import shelve
|
import shelve
|
||||||
import logging
|
import logging
|
||||||
import ConfigParser
|
|
||||||
from .models import Response, Leaf
|
from .models import Response, Leaf
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
Loading…
Reference in New Issue
Block a user