~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 12:36:48 UTC
  • Revision ID: william.grant@canonical.com-20120122123648-15b1dhwyhin355jp
Fix wsgi to cope with memo changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
            'message-id': message.get('message-id'),
117
117
            }
118
118
 
119
 
    def _trim(self, sequence, end):
120
 
        if end:
121
 
            return sequence[:-1]
122
 
        else:
123
 
            return sequence[1:]
124
 
 
125
 
    def get_messages(self, archive_uuid, order, count, memo, backward=False):
 
119
    def get_messages(self, archive_uuid, order, count, memo):
126
120
        if order in ("date", "-date"):
127
121
            reversed = order[0] == '-'
128
122
        else:
132
126
        # Get up to n+1 messages from the memo: the last item of the
133
127
        # previous batch (because that's where the memo starts) + this
134
128
        # batch.
135
 
        if backward:
136
 
            start = ''
137
 
            finish = memo
138
 
        else:
139
 
            start = memo
140
 
            finish = ''
141
129
        pairs = self.archive_messages.get(
142
 
            archive_uuid, column_count=count + 1, column_start=start,
143
 
            column_finish=finish, column_reversed=reversed).items()
 
130
            archive_uuid, column_count=count + 1,
 
131
            column_start=memo, column_reversed=reversed).items()
 
132
 
144
133
        if memo and len(pairs) and pairs[0][0] <= memo:
145
 
            pairs = self._trim(pairs, False ^ backward)
 
134
            pairs = pairs[1:]
146
135
        elif len(pairs) > count:
147
 
            pairs = self._trim(pairs, True ^ backward)
 
136
            pairs = pairs[:-1]
148
137
 
149
138
        if len(pairs) == 0:
150
139
            return (None, [], None)