1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

publish: 5.9.1

This commit is contained in:
Steffo 2020-06-22 18:45:52 +02:00
parent 15996e79f7
commit f4db47d35d
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
3 changed files with 10 additions and 5 deletions

View file

@ -5,7 +5,7 @@
[tool.poetry]
name = "royalnet"
version = "5.9.0"
version = "5.9.1"
description = "A multipurpose bot and web framework"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+"

View file

@ -36,9 +36,14 @@ class User:
def avatar_url(self):
return Column(String)
@staticmethod
async def find(alchemy, session, alias: Union[str, int]):
@classmethod
async def find(cls, alchemy, session, alias: Union[str, int]):
if isinstance(alias, str):
result = await ru.asyncify(session.query(alchemy.get(Alias)).filter_by(alias=alias.lower()).one_or_none)
elif isinstance(alias, int):
result = await ru.asyncify(session.query(alchemy.get(cls)).get, alias)
else:
raise TypeError("alias is of an invalid type.")
if result is not None:
result = result.user
return result

View file

@ -1 +1 @@
semantic = "5.9.0"
semantic = "5.9.1"