~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/model.py

  • Committer: William Grant
  • Date: 2012-01-22 11:59:29 UTC
  • Revision ID: william.grant@canonical.com-20120122115929-vfqznemirdu539ij
Expose a backward memo too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
            'date': message.get('date'),
114
114
            'from': message.get('from'),
115
115
            'subject': message.get('subject'),
 
116
            'message-id': message.get('message-id'),
116
117
            }
117
118
 
118
119
    def get_messages(self, archive_uuid, order, count, start):
120
121
            reversed = order[0] == '-'
121
122
        else:
122
123
            raise AssertionError("Unsupported order.")
 
124
        if start:
 
125
            start = uuid.UUID(start)
123
126
        pairs = self.archive_messages.get(
124
127
            archive_uuid, column_count=count + 1,
125
128
            column_start=start, column_reversed=reversed).items()
126
129
        ids = [v for k, v in pairs]
127
130
        messages = self.messages.multiget(
128
 
            ids, columns=['date', 'from', 'subject'])
 
131
            ids, columns=['date', 'from', 'subject', 'message-id'])
129
132
        actual_count = len(pairs)
130
133
        if len(pairs) > count:
131
134
            assert len(pairs) == count + 1
134
137
        else:
135
138
            next_memo = None
136
139
        return (
 
140
            None,
137
141
            [self._format_message(messages[id]) for id in ids[:actual_count]],
138
142
            next_memo,
139
143
            )