~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: Curtis Hovey
  • Date: 2012-02-24 21:31:01 UTC
  • Revision ID: curtis.hovey@canonical.com-20120224213101-jac3b2aj4nd5uwpj
Separate gracle MemoryStore to its own module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    """Raised when an Unsupported order is requested."""
20
20
 
21
21
 
 
22
class MessageIdNotFound(Exception):
 
23
    """No message matching the message_id was found in the archive."""
 
24
 
 
25
 
22
26
SUPPORTED_DISPLAY_TYPES = (
23
27
    'all',
24
28
    'text-only',
143
147
                raise ValueError('Bad request')
144
148
        data = response.read()
145
149
        return simplejson.loads(data)
 
150
 
 
151
    def hide_message(self, archive_id, message_id, hidden):
 
152
        parameters = {
 
153
            'message_id': message_id,
 
154
            'hidden': hidden,
 
155
            }
 
156
        query = {'parameters': simplejson.dumps(parameters)}
 
157
        response = self._method_archive('POST', archive_id, query)
 
158
        if response.status == httplib.BAD_REQUEST:
 
159
            if response.reason == MessageIdNotFound.__doc__:
 
160
                raise MessageIdNotFound
 
161
        data = response.read()
 
162
        return simplejson.loads(data)