From 62f3242b81caa8b916ccaba29d6989fbc7fa1f9d Mon Sep 17 00:00:00 2001 From: James Vega Date: Tue, 17 Feb 2004 02:41:09 +0000 Subject: [PATCH] I thought this already sorted by id... --- plugins/Note.py | 5 +++-- test/test_Note.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/Note.py b/plugins/Note.py index e3d607c28..f9b3c4144 100644 --- a/plugins/Note.py +++ b/plugins/Note.py @@ -322,7 +322,7 @@ class Note(callbacks.Privmsg): temp[note[1]] = [note[0]] notes = [] for (k,v) in temp.iteritems(): - notes.append('%s %s' % (', '.join(v), k)) + notes.append('%s %s' % (utils.commaAndify(v), k)) return notes def _sentnotes(self, irc, msg, receiver): @@ -345,6 +345,7 @@ class Note(callbacks.Privmsg): irc.error('That user is not in my user database.') return sql = '%s %s' % (sql, 'AND notes.to_id=%r' % receiver) + sql = '%s ORDER BY id DESC' % sql db = self.dbHandler.getDb() cursor = db.cursor() cursor.execute(sql) @@ -377,6 +378,7 @@ class Note(callbacks.Privmsg): irc.error('That user is not in my user database.') return sql = '%s %s' % (sql, 'AND notes.from_id=%r' % sender) + sql = '%s ORDER BY id DESC' % sql db = self.dbHandler.getDb() cursor = db.cursor() cursor.execute(sql) @@ -386,7 +388,6 @@ class Note(callbacks.Privmsg): else: ids = [self._formatNoteData(msg, *t) for t in cursor.fetchall()] #self.log.warning(ids) - ids.reverse() ids = self._condense(ids) irc.reply(utils.commaAndify(ids)) diff --git a/test/test_Note.py b/test/test_Note.py index 9f811d738..60c440464 100644 --- a/test/test_Note.py +++ b/test/test_Note.py @@ -70,7 +70,7 @@ if sqlite is not None: _ = self.getMsg(' ') self.assertNotError('note send inkedmn 1,2,3') _ = self.getMsg(' ') - self.assertRegexp('note list --sent', r'#1.*#2') + self.assertRegexp('note list --sent', r'#2.*#1') self.assertRegexp('note list', r'#1.*#2') self.assertRegexp('note 1', 'testing') self.assertResponse('note list --old', '#1 from inkedmn')