diff --git a/lib/nntp/tiny/message.py b/lib/nntp/tiny/message.py index c23fc40..e01578c 100644 --- a/lib/nntp/tiny/message.py +++ b/lib/nntp/tiny/message.py @@ -77,10 +77,7 @@ class MessageRange(): return "?" - def where(self, table=None): - prefix = '' if table is None else f"{table}." - column = prefix + 'id' - + def where(self, column='id'): if self.id is not None: return "%s = %d" % (column, self.id) diff --git a/lib/nntp/tiny/session.py b/lib/nntp/tiny/session.py index bf21ef9..b1ea681 100644 --- a/lib/nntp/tiny/session.py +++ b/lib/nntp/tiny/session.py @@ -259,7 +259,7 @@ class Session(): if len(args) > 1: msgrange = MessageRange.parse(args[1]) - sql += " and " + msgrange.where() + sql += " and " + msgrange.where('message_id') summary = self._newsgroup_summary(newsgroup) cr = self.db.execute(sql, (newsgroup.id,)) @@ -547,7 +547,7 @@ class Session(): and newsgroup_message.newsgroup_id = ? """ - sql += " and " + msgrange.where('message') + sql += " and " + msgrange.where('newsgroup_message.message_id') cr = self.db.query_sql(Message, sql, (self.newsgroup.id,))