101
101
'subject': message['subject'],
104
def get_messages(self, archive_uuid, count, order):
104
def get_messages(self, archive_uuid, order, count, start):
105
105
if order in ("date", "-date"):
106
106
reversed = order[0] == '-'
108
108
raise AssertionError("Unsupported order.")
109
ids = self.archive_messages.get(
110
archive_uuid, column_count=count,
111
column_reversed=reversed).values()
112
messages = self.messages.multiget(ids)
113
return [self._format_message(messages[id]) for id in ids]
109
pairs = self.archive_messages.get(
110
archive_uuid, column_count=count+1,
111
column_start=start, column_reversed=reversed).items()
112
ids = [v for k, v in pairs]
113
messages = self.messages.multiget(
114
ids, columns=['date', 'from', 'subject'])
115
actual_count = len(pairs)
116
if len(pairs) > count:
117
assert len(pairs) == count + 1
119
next_memo = str(pairs[count][0])
123
[self._format_message(messages[id]) for id in ids[:actual_count]],