server/general: ditch falcon for in-house WSGI app

For quite some time, I hated Falcon's class maps approach that caused
more chaos than good for Szurubooru. I've taken a look at the other
frameworks (hug, flask, etc) again, but they all looked too
bloated/over-engineered. I decided to just talk to WSGI myself.

Regex-based routing may not be the fastest in the world, but I'm fine
with response time of 10 ms for cached /posts.
This commit is contained in:
rr-
2016-08-14 12:35:14 +02:00
parent d102c9bdba
commit af62f8c45a
61 changed files with 2447 additions and 3096 deletions

View File

@ -1,14 +1,12 @@
from szurubooru import search
from szurubooru.api.base_api import BaseApi
from szurubooru.func import auth, snapshots
from szurubooru.rest import routes
class SnapshotListApi(BaseApi):
def __init__(self):
super().__init__()
self._search_executor = search.Executor(
search.configs.SnapshotSearchConfig())
_search_executor = search.Executor(
search.configs.SnapshotSearchConfig())
def get(self, ctx):
auth.verify_privilege(ctx.user, 'snapshots:list')
return self._search_executor.execute_and_serialize(
ctx, snapshots.serialize_snapshot)
@routes.get('/snapshots/?')
def get_snapshots(ctx, _params=None):
auth.verify_privilege(ctx.user, 'snapshots:list')
return _search_executor.execute_and_serialize(
ctx, snapshots.serialize_snapshot)