diff --git a/BUGS.md b/BUGS.md index fe45c8d..be95626 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,6 +1,10 @@ # BUGS +- SQLAlchemy error (rollback em accao no final de um topico): + Users/mjsb/Library/Python/3.7/lib/python/site-packages/sqlalchemy/sql/crud.py:700: SAWarning: Column 'studenttopic.student_id' is marked as a member of the primary key for table 'studenttopic', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed. Primary key columns typically may not store NULL. Note that as of SQLAlchemy 1.1, 'autoincrement=True' must be indicated explicitly for composite (e.g. multicolumn) primary keys if AUTO_INCREMENT/SERIAL/IDENTITY behavior is expected for one of the columns in the primary key. CREATE TABLE statements are impacted by this change as well on most backends. + util.warn(msg) + - quando a pergunta devolve comments, este é apresentado, mas fica persistente nas tentativas seguintes. devia ser limpo apos a segunda submissao. - a opcao max_tries na especificacao das perguntas é cumbersome... usar antes tries? - tabelas nas perguntas radio/checkbox não ocupam todo o espaço como em question. diff --git a/learnapp.py b/learnapp.py index 7c85c52..2a458cb 100644 --- a/learnapp.py +++ b/learnapp.py @@ -195,9 +195,11 @@ class LearnApp(object): # ------------------------------------------------------------------------ # Start new topic # ------------------------------------------------------------------------ - def start_topic(self, uid, topic): + async def start_topic(self, uid, topic): + loop = asyncio.get_running_loop() try: - self.online[uid]['state'].init_topic(topic) + await loop.run_in_executor(None, self.online[uid]['state'].init_topic, topic) + # self.online[uid]['state'].init_topic(topic) except KeyError as e: logger.warning(f'User "{uid}" tried to open nonexistent topic: "{topic}"') raise e diff --git a/serve.py b/serve.py index 28ac080..1b59ff5 100755 --- a/serve.py +++ b/serve.py @@ -146,11 +146,11 @@ class RootHandler(BaseHandler): # ---------------------------------------------------------------------------- class TopicHandler(BaseHandler): @tornado.web.authenticated - def get(self, topic): + async def get(self, topic): uid = self.current_user try: - self.learn.start_topic(uid, topic) + await self.learn.start_topic(uid, topic) except KeyError: self.redirect('/') else: -- libgit2 0.21.2