Commit 7a3a535c authored by Gero Müller's avatar Gero Müller
Browse files

rename signature tool

parent da706004
......@@ -35,7 +35,7 @@ class DummyController(AbstractController):
@cherrypy.expose
@cherrypy.tools.workspace(on=False)
@cherrypy.tools.signature()
@cherrypy.tools.json_parameters()
def sigtest(self, o, l, i, s):
for elem in (o, l, i, s):
print "%s (%s)" % (elem, type(elem))
......
......@@ -555,7 +555,7 @@ class JobmanagementController(AbstractController):
outputPath)
@cherrypy.expose
@cherrypy.tools.signature()
@cherrypy.tools.json_parameters()
def submitJobs(self, commands, manager, preExecutionScript="",
postExecutionScript="", outputPath=""):
if(len(commands) == 0):
......
......@@ -260,8 +260,8 @@ class Server(object):
from vispa.tools.ajax import AjaxTool
cherrypy.tools.ajax = AjaxTool()
from vispa.tools.signature import SignatureMapper
cherrypy.tools.signature = SignatureMapper()
from vispa.tools.json_parameters import JsonParameters
cherrypy.tools.json_parameters = JsonParameters()
try:
from ws4py.server.cherrypyserver import WebSocketTool # @UnresolvedImport
......
# -*- coding: utf-8 -*-
# imports
import cherrypy
import vispa
import logging
import json
import vispa
logger = logging.getLogger(__name__)
class SignatureMapper(cherrypy.Tool):
class JsonParameters(cherrypy.Tool):
def __init__(self):
cherrypy.Tool.__init__(self, "before_handler", self.before_handler, priority=54)
cherrypy.Tool.__init__(self, "before_handler",
self.before_handler,
priority=54)
def before_handler(self):
req = cherrypy.request
if req.method != "POST" or req.headers["Content-Type"] != "application/json":
is_post = req.method != "POST"
is_json = req.headers["Content-Type"] != "application/json"
if not (is_post and is_json):
return
if len(req.params.keys()):
if len(req.params):
return
try:
data = json.loads(req.body.fp.read())
cherrypy.request.params.update(data)
except:
pass
vispa.log_exception()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment