fix error when only one chat is indexed

This commit is contained in:
odysseusmax 2021-06-13 16:37:45 +05:30
parent 11f33611ae
commit ce1aec90a9
2 changed files with 4 additions and 2 deletions

View File

@ -5,8 +5,10 @@ import aiohttp_jinja2
class HomeView: class HomeView:
@aiohttp_jinja2.template("home.html") @aiohttp_jinja2.template("home.html")
async def home(self, req): async def home(self, req):
print(self.chat_ids)
if len(self.chat_ids) == 1: if len(self.chat_ids) == 1:
raise web.HTTPFound(f"{self.chat_ids[0]['alias_id']}") (chat,) = self.chat_ids.values()
return web.HTTPFound(f"{chat['alias_id']}")
return { return {
"chats": [ "chats": [

View File

@ -3,4 +3,4 @@ from aiohttp import web
class WildcardView: class WildcardView:
async def wildcard(self, req): async def wildcard(self, req):
raise web.HTTPFound("/") return web.HTTPFound("/")