Fix regression.

This commit is contained in:
Nexus 2023-03-20 18:04:38 +00:00
parent 96f70cfcda
commit f6f255cb51
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -39,16 +39,15 @@ T_co = TypeVar("T_co", covariant=True)
if Path("/data").exists(): if Path("/data").exists():
_pth = "/data/main.db" _pth = "/data/main.db"
else: try:
_pth = "/./main.db"
try:
Path(_pth).touch() Path(_pth).touch()
except PermissionError as e: except PermissionError as e:
print("Failed to create database:", e, file=sys.stderr) print("Failed to create database:", e, file=sys.stderr)
sys.exit(1) sys.exit(1)
else:
_pth = "/main.db"
registry = orm.ModelRegistry(Database("sqlite:///main.db")) registry = orm.ModelRegistry(Database("sqlite://" + _pth))
async def get_or_none(model: T, **kw) -> Optional[T_co]: async def get_or_none(model: T, **kw) -> Optional[T_co]: