##// END OF EJS Templates
Backport PR #8098: Remove image resizer...
Backport PR #8098: Remove image resizer This PR removes the image resizer for images. Removing the resizer helps a lot to solve the image overflow issue in #7701. Related PR: #8062. Before: ![screenshot from 2015-03-20 10 48 02](https://cloud.githubusercontent.com/assets/599274/6756414/624077fa-ceef-11e4-8df2-53d0bdf7338e.png) ...

File last commit:

r19975:c42828d1
r21016:80ed08e4
Show More
api_handlers.py
44 lines | 1.3 KiB | text/x-python | PythonLexer
import json
from tornado import web, gen
from ..base.handlers import IPythonHandler, json_errors
from ..utils import url_path_join
class TerminalRootHandler(IPythonHandler):
@web.authenticated
@json_errors
def get(self):
tm = self.terminal_manager
terms = [{'name': name} for name in tm.terminals]
self.finish(json.dumps(terms))
@web.authenticated
@json_errors
def post(self):
"""POST /terminals creates a new terminal and redirects to it"""
name, _ = self.terminal_manager.new_named_terminal()
self.finish(json.dumps({'name': name}))
class TerminalHandler(IPythonHandler):
SUPPORTED_METHODS = ('GET', 'DELETE')
@web.authenticated
@json_errors
def get(self, name):
tm = self.terminal_manager
if name in tm.terminals:
self.finish(json.dumps({'name': name}))
else:
raise web.HTTPError(404, "Terminal not found: %r" % name)
@web.authenticated
@json_errors
@gen.coroutine
def delete(self, name):
tm = self.terminal_manager
if name in tm.terminals:
yield tm.terminate(name, force=True)
self.set_status(204)
self.finish()
else:
raise web.HTTPError(404, "Terminal not found: %r" % name)