Work on demo
This commit is contained in:
parent
607186a168
commit
d95b60dd72
|
@ -1,7 +1,7 @@
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
metadata = sa.Metadata()
|
metadata = sa.MetaData()
|
||||||
|
|
||||||
|
|
||||||
users = sa.Table(
|
users = sa.Table(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from aiohttp_security.authorization import AbstractAuthorizationPolicy
|
from aiohttp_security.abc import AbstractAuthorizationPolicy
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import functools
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
|
|
||||||
from aiohttp_security import remember, forbid, authorized_user_id, permits
|
from aiohttp_security import remember, forget, authorized_userid, permits
|
||||||
|
|
||||||
|
|
||||||
def require(permission):
|
def require(permission):
|
||||||
|
@ -46,7 +46,7 @@ class Web:
|
||||||
def protected(self, request):
|
def protected(self, request):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@asyncio.cororutine
|
@asyncio.coroutine
|
||||||
def configure(self, app):
|
def configure(self, app):
|
||||||
app.add_route('GET', '/', self.index, name='index')
|
app.add_route('GET', '/', self.index, name='index')
|
||||||
app.add_route('POST', '/login', self.login, name='login')
|
app.add_route('POST', '/login', self.login, name='login')
|
||||||
|
|
13
demo/main.py
13
demo/main.py
|
@ -47,9 +47,10 @@ def finalize(srv, app, handler):
|
||||||
yield from app.finish()
|
yield from app.finish()
|
||||||
|
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
def main():
|
||||||
srv, app, handler = loop.run_until_complete(init(loop))
|
loop = asyncio.get_event_loop()
|
||||||
try:
|
srv, app, handler = loop.run_until_complete(init(loop))
|
||||||
loop.run_forever()
|
try:
|
||||||
except KeyboardInterrupt:
|
loop.run_forever()
|
||||||
loop.run_until_complete((finalize(srv, app, handler)))
|
except KeyboardInterrupt:
|
||||||
|
loop.run_until_complete((finalize(srv, app, handler)))
|
||||||
|
|
Loading…
Reference in New Issue