First working version.
Some checks failed
devranta build / Build (push) Failing after 6s

This commit is contained in:
retoor 2024-12-14 21:45:36 +01:00
parent 7ae5e613b7
commit ab19504738
5 changed files with 26 additions and 27 deletions

View File

@ -1,6 +1,7 @@
PYTHON=./.venv/bin/python
PIP=./.venv/bin/pip
BIN=./.venv/bin
ENV=./.venv/bin/activate
APP=form
all: ensure_env format install build test

View File

@ -15,10 +15,12 @@ package_dir =
python_requires = >=3.7
install_requires =
requests
app @ retoor.molodetz.nl/retoor/app
app @ git+https://retoor.molodetz.nl/retoor/app
captcha
[options.packages.find]
where = src
[options.entry_points]
console_scripts =
form = form.__main__:main
form.serve = form.__main__:main

View File

@ -1,14 +1,13 @@
from form.app import Application
from app.app import argument_parser
from form.app import Application
def main():
args = argument_parser.parse_args()
app = Application(db_file="sqlite:///form.db",web_db=args.web_db))
app.run(host=args.host,port=args.port)
if __name__ == '__main__':
app = Application(db_path="sqlite:///form.db", db_web=args.db_web)
app.run(host=args.host, port=args.port)
if __name__ == "__main__":
main()

View File

@ -1,26 +1,27 @@
from app.app import Application as BaseApplication
import uuid
import asyncio
from aiohttp import web
class Application(BaseApplication):
def __init__(self, *args, **kwargs):
self.forms_created
self.forms_validate_success = 0
self.forms_validate_failure = 0
self.forms_validate_pending = 0
super().__init__(*args, **kwargs):
super().__init__(*args, **kwargs)
self.router.add_get("/", self.index_handler)
@property
def forms_created(self):
return int(self.sget("forms_created", 0))
async def index_handler(self):
return web.json_response(dict(
message="Nothing to see here",
error="404"
),status_code=404)
@forms_created.setter
def forms_created(self, value):
self.sset("forms_created", int(value))
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
)

View File

@ -1,4 +1,3 @@
import asyncio
import unittest
@ -11,8 +10,5 @@ class AppTestCase(unittest.IsolatedAsyncioTestCase):
self.assertTrue(True)
if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()