From: Menno Smits Date: Sun, 5 Jun 2011 16:20:15 +0000 (+0100) Subject: Remaining gaps in IMAPClient class docs done. X-Git-Tag: 0.8~35 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=f6d96476e8897c55dfc5cefdd05fc49661fb0b7d;p=imapclient.git Remaining gaps in IMAPClient class docs done. This is sufficient for an initial release --- diff --git a/doc-src/index.rst b/doc-src/index.rst index 133cd80..f06fd6d 100644 --- a/doc-src/index.rst +++ b/doc-src/index.rst @@ -110,7 +110,7 @@ Folder Name Encoding ~~~~~~~~~~~~~~~~~~~~ Any method that takes a folder name will accept a standard string or a unicode string. Unicode strings will be transparently encoded using -modified UTF-7 as specified by `RFC-3501 +modified UTF-7 as specified by `RFC-3501 section 5.1.3 `_. This allows for arbitrary unicode characters (eg. non-English characters) to be used in folder names. diff --git a/imapclient/imapclient.py b/imapclient/imapclient.py index 49cbcc2..7319b40 100644 --- a/imapclient/imapclient.py +++ b/imapclient/imapclient.py @@ -133,9 +133,11 @@ class IMAPClient(object): def get_folder_delimiter(self): """Return the folder separator used by the IMAP server. - WARNING: The implementation just picks the first folder - separator from the first namespace returned. This is not - particularly sensible. Use namespace instead(). + .. warning:: + + The implementation just picks the first folder separator + from the first namespace returned. This is not + particularly sensible. Use namespace instead(). """ warnings.warn(DeprecationWarning('get_folder_delimiter is going away. Use namespace() instead.')) for part in self.namespace(): @@ -343,7 +345,19 @@ class IMAPClient(object): def search(self, criteria='ALL', charset=None): """Return a list of messages ids matching *criteria*. - XXX more detail + *criteria* should be a list of of one or more criteria + specifications or a single critera string. Example values + include:: + + 'NOT DELETED' + 'UNSEEN' + 'SINCE 1-Feb-2011' + + *charset* specifies the character set of the strings in the + criteria. It defaults to US-ASCII. + + See `RFC-3501 section 6.4.4 `_ + for more details. """ if not criteria: raise ValueError('no criteria specified') @@ -368,17 +382,21 @@ class IMAPClient(object): return [ long(i) for i in data[0].split() ] - def sort(self, sort_criteria, criteria='ALL', charset='UTF-8' ): + def sort(self, sort_criteria, criteria='ALL', charset='UTF-8'): """Return a list of message ids sorted by *sort_criteria* and optionally filtered by *criteria*. - The *critera* are as per search(). + Example values for *sort_criteria* include:: - Note that this is an extension to the IMAP4: - http://www.ietf.org/internet-drafts/draft-ietf-imapext-sort-19.txt + ARRIVAL + REVERSE SIZE + SUBJECT - XXX needs more detail - XXX explain charset + The *criteria* argument is as per search(). + See `RFC-5256 `_ for full details. + + Note that SORT is an extension to the IMAP4 standard so it may + not be supported by all IMAP servers. """ if not criteria: raise ValueError('no criteria specified') @@ -400,13 +418,14 @@ class IMAPClient(object): self._checkok('sort', typ, data) - return [ long(i) for i in data[0].split() ] + return [long(i) for i in data[0].split()] def get_flags(self, messages): - """Returns the flags set for each message in *messages* as a - dictionary structured like this: - ``{ msgid1: [flag1, flag2, ... ], }``. + """Return the flags set for each message in *messages*. + + The return value is a dictionary structured like this: ``{ + msgid1: [flag1, flag2, ... ], }``. """ response = self.fetch(messages, ['FLAGS']) return self._flatten_dict(response)