~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: Curtis Hovey
  • Date: 2012-01-30 20:37:22 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: curtis.hovey@canonical.com-20120130203722-gjzvehl3bdir11nl
Moved the display_type arg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
            raise Exception('!!')
75
75
 
76
76
    def get_messages(self, archive_id, message_ids=None, limit=None,
77
 
                     memo=None, order=None, headers=None, display_type='all',
78
 
                     max_body_length=None, include_hidden=False):
 
77
                     memo=None, order=None, headers=None,
 
78
                     max_body_length=None, include_hidden=False,
 
79
                     display_type='all'):
79
80
        """Retrieve specified messages.
80
81
 
81
82
        :param archive_id: The archive to retrieve messages from.
92
93
        :param headers: The headers to include in the message.  Only headers
93
94
            actually present in the message will be provided.  If unspecified,
94
95
            most headers will be included.
95
 
        :param display_type: Adjust the message content to meet the needs of
96
 
            the intended display. Valid values are:
97
 
            all: (the default) include all message content.
98
 
            text-only: include only plain/text parts; exclude all other parts.
99
 
            headers-only: include only the message headers.
100
96
        :param max_body_length: The maximum length for a message's body.  When
101
97
            multiple messages are nested (as with a thread), this applies to
102
98
            each message's body, not the aggregate length of all messages'
103
99
            bodies.
104
100
        :param include_hidden: If true, include messages that have been
105
101
            flagged "hidden" in the results.
 
102
        :param display_type: Adjust the message content to meet the needs of
 
103
            the intended display. Valid values are:
 
104
            all: (the default) include all message content.
 
105
            text-only: include only plain/text parts; exclude all other parts.
 
106
            headers-only: include only the message headers.
106
107
        """
107
108
        parameters = {}
108
109
        if message_ids is not None:
115
116
            parameters['order'] = order
116
117
        if headers is not None:
117
118
            parameters['headers'] = headers
 
119
        if max_body_length is not None:
 
120
            parameters['max_body_length'] = max_body_length
118
121
        if display_type not in SUPPORTED_DISPLAY_TYPES:
119
122
            raise UnsupportedDisplayType
120
 
        if max_body_length is not None:
121
 
            parameters['max_body_length'] = max_body_length
 
123
        parameters['display_type'] = display_type
122
124
        parameters['include_hidden'] = include_hidden
123
125
        query = {'parameters': simplejson.dumps(parameters)}
124
126
        response = self._method_archive('GET', archive_id, query)