This commit is contained in:
parent
7ae5e613b7
commit
ab19504738
1
Makefile
1
Makefile
@ -1,6 +1,7 @@
|
|||||||
PYTHON=./.venv/bin/python
|
PYTHON=./.venv/bin/python
|
||||||
PIP=./.venv/bin/pip
|
PIP=./.venv/bin/pip
|
||||||
BIN=./.venv/bin
|
BIN=./.venv/bin
|
||||||
|
ENV=./.venv/bin/activate
|
||||||
APP=form
|
APP=form
|
||||||
|
|
||||||
all: ensure_env format install build test
|
all: ensure_env format install build test
|
||||||
|
@ -15,10 +15,12 @@ package_dir =
|
|||||||
python_requires = >=3.7
|
python_requires = >=3.7
|
||||||
install_requires =
|
install_requires =
|
||||||
requests
|
requests
|
||||||
app @ retoor.molodetz.nl/retoor/app
|
app @ git+https://retoor.molodetz.nl/retoor/app
|
||||||
|
captcha
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
where = src
|
where = src
|
||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
form = form.__main__:main
|
form.serve = form.__main__:main
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
from form.app import Application
|
|
||||||
from app.app import argument_parser
|
from app.app import argument_parser
|
||||||
|
|
||||||
|
from form.app import Application
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = argument_parser.parse_args()
|
args = argument_parser.parse_args()
|
||||||
app = Application(db_file="sqlite:///form.db",web_db=args.web_db))
|
app = Application(db_path="sqlite:///form.db", db_web=args.db_web)
|
||||||
app.run(host=args.host, port=args.port)
|
app.run(host=args.host, port=args.port)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,26 +1,27 @@
|
|||||||
from app.app import Application as BaseApplication
|
from app.app import Application as BaseApplication
|
||||||
import uuid
|
from aiohttp import web
|
||||||
import asyncio
|
|
||||||
|
|
||||||
|
|
||||||
class Application(BaseApplication):
|
class Application(BaseApplication):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
self.forms_created
|
super().__init__(*args, **kwargs)
|
||||||
self.forms_validate_success = 0
|
|
||||||
self.forms_validate_failure = 0
|
|
||||||
self.forms_validate_pending = 0
|
|
||||||
|
|
||||||
super().__init__(*args, **kwargs):
|
|
||||||
|
|
||||||
self.router.add_get("/", self.index_handler)
|
self.router.add_get("/", self.index_handler)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def forms_created(self):
|
||||||
|
return int(self.sget("forms_created", 0))
|
||||||
|
|
||||||
async def index_handler(self):
|
@forms_created.setter
|
||||||
return web.json_response(dict(
|
def forms_created(self, value):
|
||||||
message="Nothing to see here",
|
self.sset("forms_created", int(value))
|
||||||
error="404"
|
|
||||||
),status_code=404)
|
|
||||||
|
|
||||||
|
async def index_handler(self,request):
|
||||||
|
self.forms_created += 1
|
||||||
|
print(self.forms_created)
|
||||||
|
|
||||||
|
return web.json_response(
|
||||||
|
{"message": "Nothing to see here", "error": "404"}, status=404
|
||||||
|
)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import asyncio
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
@ -11,8 +10,5 @@ class AppTestCase(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user