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

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: William Grant
  • Date: 2012-04-20 02:20:58 UTC
  • mfrom: (6.1.70 trunk)
  • Revision ID: william.grant@canonical.com-20120420022058-3nkracsmlg7akydu
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
__metaclass__ = type
 
2
 
1
3
import httplib
2
4
import simplejson
3
5
from urlparse import urlunparse
7
9
)
8
10
 
9
11
from grackle.error import (
 
12
    ArchiveIdExists,
10
13
    MessageIdNotFound,
11
14
    UnparsableDateRange,
12
15
    UnsupportedDisplayType,
55
58
        :param mbox: An optional mbox with messages to add to the new archive.
56
59
        """
57
60
        response = self._method_archive(
58
 
            'POST', '', {'archive_id': archive_id}, None)
 
61
            'PUT', archive_id, {}, None)
59
62
        response.read()
60
63
        if response.status == httplib.BAD_REQUEST:
 
64
            if response.reason == ArchiveIdExists.__doc__:
 
65
                raise ArchiveIdExists
61
66
            raise Exception('wtf')
62
67
        elif response.status == httplib.CREATED:
63
68
            return
77
82
            'PUT', path, {}, file_obj.read())
78
83
        response.read()
79
84
        if response.status == httplib.BAD_REQUEST:
 
85
            if response.reason == ArchiveIdExists.__doc__:
 
86
                raise ArchiveIdExists
80
87
            raise Exception('wtf')
81
88
        elif response.status == httplib.CREATED:
82
89
            return