Commit 8f84079a authored by Marcel Rieger's avatar Marcel Rieger
Browse files

Enable ajax tool by default on /ajax mount.

parent 3635f598
......@@ -26,7 +26,6 @@ class AjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.user(on=False)
@cherrypy.tools.ajax()
def login(self, username, password):
db = cherrypy.request.db
user = User.login(db, username, password)
......@@ -35,7 +34,6 @@ class AjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.user(on=False)
@cherrypy.tools.ajax()
@cherrypy.tools.allow(methods=["POST"])
def register(self, username, email):
db = cherrypy.request.db
......@@ -48,7 +46,6 @@ class AjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.user(on=False)
@cherrypy.tools.ajax()
@cherrypy.tools.allow(methods=["POST"])
def forgotpassword(self, username):
if vispa.config("web", "forgot.use", False) and not cherrypy.session.get("is_guest", False):
......@@ -58,7 +55,6 @@ class AjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.user(on=False)
@cherrypy.tools.ajax()
def setpassword(self, hash, password):
user = User.set_password(cherrypy.request.db, hash, password)
if user.active():
......@@ -66,7 +62,6 @@ class AjaxController(AbstractController):
cherrypy.session["user_name"] = user.name
@cherrypy.expose
@cherrypy.tools.ajax()
def setvispapreference(self, name, value=u"{}"):
db = cherrypy.request.db
user_id = self.get("user_id")
......@@ -74,7 +69,6 @@ class AjaxController(AbstractController):
VispaPreference.set_value(db, user_id, name, value)
@cherrypy.expose
@cherrypy.tools.ajax()
def setextensionpreference(self, name, value=u"{}"):
db = cherrypy.request.db
user_id = self.get("user_id")
......@@ -82,21 +76,18 @@ class AjaxController(AbstractController):
ExtensionPreference.set_value(db, user_id, name, value)
@cherrypy.expose
@cherrypy.tools.ajax()
def setvispashortcuts(self, name, value=u"{}"):
db = cherrypy.request.db
user_id = self.get("user_id")
VispaShortcuts.set_value(db, user_id, name, value)
@cherrypy.expose
@cherrypy.tools.ajax()
def setextensionshortcuts(self, name, value=u"{}"):
db = cherrypy.request.db
user_id = self.get("user_id")
ExtensionShortcuts.set_value(db, user_id, name, value)
@cherrypy.expose
@cherrypy.tools.ajax()
def addworkspace(self, name, host, login, key=None, cmd=None):
if not vispa.config("workspace", "add", True):
raise AjaxException("No permission to add a new Workspace!")
......@@ -117,7 +108,6 @@ class AjaxController(AbstractController):
return self._root.workspace_data(workspace)
@cherrypy.expose
@cherrypy.tools.ajax()
def deleteworkspace(self, wid):
if not vispa.config("workspace", "add", True):
raise AjaxException("No permission to delete a Workspace!")
......@@ -137,7 +127,6 @@ class AjaxController(AbstractController):
raise AjaxException("Couldn't remove this Workspace!")
@cherrypy.expose
@cherrypy.tools.ajax()
def connectworkspace(self, wid, password=None):
db = cherrypy.request.db
user = cherrypy.request.user
......@@ -151,7 +140,6 @@ class AjaxController(AbstractController):
vispa.workspace.connect(workspace, user, db, password)
@cherrypy.expose
@cherrypy.tools.ajax()
def disconnectworkspace(self, wid):
db = cherrypy.request.db
user = cherrypy.request.user
......@@ -165,7 +153,6 @@ class AjaxController(AbstractController):
vispa.workspace.disconnect(workspace)
@cherrypy.expose
@cherrypy.tools.ajax()
def getworkspacedata(self, wid=None):
workspace = None
if wid:
......@@ -175,7 +162,6 @@ class AjaxController(AbstractController):
return self._root.workspace_data(workspace=workspace)
@cherrypy.expose
@cherrypy.tools.ajax()
def getworkspacestate(self, wid):
db = cherrypy.request.db
userid = cherrypy.request.user.id
......@@ -183,7 +169,6 @@ class AjaxController(AbstractController):
return WorkspaceState.get_state(db, wid, userid) or "{}"
@cherrypy.expose
@cherrypy.tools.ajax()
def setworkspacestate(self, wid, state):
db = cherrypy.request.db
userid = cherrypy.request.user.id
......
......@@ -91,7 +91,6 @@ class FSController(AbstractController):
class FSAjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.ajax()
def exists(self, path, filetype=None):
self.release_session()
fs = self.get('fs')
......@@ -105,7 +104,6 @@ class FSAjaxController(AbstractController):
return "Failed"
@cherrypy.expose
@cherrypy.tools.ajax()
def filecount(self, path, watch_id=None):
self.release_session()
fs = self.get('fs')
......@@ -143,7 +141,6 @@ class FSAjaxController(AbstractController):
watch_id=watch_id)
@cherrypy.expose
@cherrypy.tools.ajax()
def createfolder(self, path, name):
self.release_session()
fs = self.get('fs')
......@@ -152,7 +149,6 @@ class FSAjaxController(AbstractController):
fs.create_folder(path, name)
@cherrypy.expose
@cherrypy.tools.ajax()
def createfile(self, path, name):
self.release_session()
fs = self.get('fs')
......@@ -161,7 +157,6 @@ class FSAjaxController(AbstractController):
fs.create_file(path, name)
@cherrypy.expose
@cherrypy.tools.ajax()
def rename(self, path, name, new_name):
self.release_session()
fs = self.get('fs')
......@@ -169,7 +164,6 @@ class FSAjaxController(AbstractController):
return fs.rename(path, name, new_name)
@cherrypy.expose
@cherrypy.tools.ajax()
def remove(self, path):
self.release_session()
fs = self.get('fs')
......@@ -185,7 +179,6 @@ class FSAjaxController(AbstractController):
return
@cherrypy.expose
@cherrypy.tools.ajax()
def move(self, source, destination):
self.release_session()
fs = self.get('fs')
......@@ -197,7 +190,6 @@ class FSAjaxController(AbstractController):
fs.move(source, destination)
@cherrypy.expose
@cherrypy.tools.ajax()
def compress(self, path, paths, name):
self.release_session()
fs = self.get('fs')
......@@ -208,7 +200,6 @@ class FSAjaxController(AbstractController):
fs.compress(path, paths, name)
@cherrypy.expose
@cherrypy.tools.ajax()
def decompress(self, file):
self.release_session()
fs = self.get('fs')
......@@ -216,7 +207,6 @@ class FSAjaxController(AbstractController):
fs.decompress(file)
@cherrypy.expose
@cherrypy.tools.ajax()
def paste(self, path, paths, cut):
self.release_session()
fs = self.get('fs')
......@@ -230,7 +220,6 @@ class FSAjaxController(AbstractController):
return
@cherrypy.expose
@cherrypy.tools.ajax()
def upload(self, *args, **kwargs):
self.release_session()
fs = self.get('fs')
......@@ -269,7 +258,6 @@ class FSAjaxController(AbstractController):
append = True
@cherrypy.expose
@cherrypy.tools.ajax()
def isbrowserfile(self, path):
self.release_session()
fs = self.get('fs')
......@@ -284,7 +272,6 @@ class FSAjaxController(AbstractController):
return str(e)
@cherrypy.expose
@cherrypy.tools.ajax()
def getsuggestions(self, path, length=10, append_hidden=True):
self.release_session()
fs = self.get('fs')
......@@ -321,7 +308,6 @@ class FSAjaxController(AbstractController):
watch_id=watch_id)
@cherrypy.expose
@cherrypy.tools.ajax()
def watch(self, path, watch_id):
self.release_session()
fs = self.get('fs')
......@@ -336,7 +322,6 @@ class FSAjaxController(AbstractController):
return {"success": not err}
@cherrypy.expose
@cherrypy.tools.ajax()
def unwatch(self, watch_id=None):
self.release_session()
fs = self.get('fs')
......@@ -359,7 +344,6 @@ class FSAjaxController(AbstractController):
return fs.get_workspaceini(request, fail_on_missing=fail_on_missing)
@cherrypy.expose
@cherrypy.tools.ajax()
def set_workspaceini(self, request):
self.release_session()
fs = self.get('fs')
......@@ -371,7 +355,6 @@ class FSAjaxController(AbstractController):
return {"success": not err}
@cherrypy.expose
@cherrypy.tools.ajax()
def expand(self, path):
self.release_session()
fs = self.get('fs')
......@@ -382,7 +365,6 @@ class FSAjaxController(AbstractController):
return fs.expand(path)
@cherrypy.expose
@cherrypy.tools.ajax()
def checkPermissions(self, path):
self.release_session()
fs = self.get('fs')
......
......@@ -105,6 +105,7 @@ class Server(object):
'engine.autoreload.on': False
}
@property
def __default_mount_config(self):
base_dynamic = vispa.url.dynamic('/')
base_static = vispa.url.static('/', timestamp=False)
......@@ -142,9 +143,10 @@ class Server(object):
'/fs': {
'tools.workspace.on': True
},
'/ajax/fs': {
'tools.workspace.on': True
},
'/ajax': {
'tools.workspace.on': True,
'tools.ajax.on': True
}
}
def __init__(self, **kwargs):
......@@ -291,7 +293,7 @@ class Server(object):
script_name = vispa.url.dynamic('/', encoding='utf-8')
logger.info("mount app")
self.__application = cherrypy.tree.mount(self.controller, script_name,
self.__default_mount_config())
self.__default_mount_config)
if os.path.isfile(cherrypy_conf):
self.__application.merge(cherrypy_conf)
......
Markdown is supported
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