From: Menno Smits Date: Wed, 22 Apr 2009 00:04:52 +0000 (+0100) Subject: Documentation updates X-Git-Tag: 0.7~84 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=54ce63663a48160176e52d7e1925b34e53d64d17;p=imapclient.git Documentation updates --- diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0f6f35c --- /dev/null +++ b/NEWS @@ -0,0 +1,15 @@ +#XXX standard format? +#XXX should this be NEWS? + +folder name quoting bugs + +transparent internationalised folder name handling + +timezone handling fixed + +more tests + +includes mock.py + + + diff --git a/README b/README index 6f875f5..ee39334 100644 --- a/README +++ b/README @@ -8,6 +8,11 @@ Features: - IMAP server responses are fully parsed and readily useable. - IMAP unique message IDs (UIDs) are handled transparently. There is no need to call different methods to use UIDs. + - Escaping for internationalized mailbox names is transparently handled. + Unicode mailbox names may be passed as input where-ever a folder name is + accepted. + - Time zones are transparently handled including when the server and client + are in different zones. - Convenience methods are provided for commonly used functionality. - Exceptions are raised when errors occur. @@ -66,8 +71,8 @@ It must be used with an account that has an INBOX folder and write access to the account. The folders and contents of the account don't matter. WARNING: The operations performed by livetest.py are destructive. Emails and -folders in the test account WILL BE CHANGED AND DELETED. Please only run -against a dummy account that you don't care about. +folders in the test account WILL BE DELETED. Please only run against a dummy +account that you don't care about. Run livetest.py with the --help option to see usage. diff --git a/TODO b/TODO index d8f0da4..99ae360 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,9 @@ -- email JP Calderone re use of his code - - update docs & web site: - transparent folder escaping - - changelog - - compat breakage for for folder escaping and timezone handling + - update NEWS ---- release 0.5 ---- +- email JP Calderone re use of his code - a bunch of stuff doesn't work with gmail's IMAP (see livetest.py) - automate releases with bzr diff --git a/imapclient/imapclient.py b/imapclient/imapclient.py index 140157b..055ec79 100644 --- a/imapclient/imapclient.py +++ b/imapclient/imapclient.py @@ -54,6 +54,14 @@ class IMAPClient(object): message flags (eg. [DELETED, 'foo', 'Bar']) or a single message flag (eg. 'Foo'). See the constants at the top of this file for commonly used flags. + 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-2060. Such folder names will be returned + as unicode strings by methods that return folder names. + + Transparent folder name encoding can be enabled or disabled with the + folder_encode attribute. It defaults to True. + The IMAP related exceptions that will be raised by this class are: IMAPClient.Error IMAPClient.AbortError @@ -156,7 +164,10 @@ class IMAPClient(object): @param directory: The base directory to look for folders from. @param pattern: A pattern to match against folder names. Only folder names matching this pattern will be returned. Wildcards accepted. - @return: A list of folder names. + @return: A list of folder names. Each folder name will be either a + string or a unicode string (if the folder on the server required + decoding). If the folder_encode attribute is False, no decoding + will be performed and only ordinary strings will be returned. ''' typ, data = self._imap.list(directory, pattern) self._checkok('list', typ, data) @@ -185,7 +196,7 @@ class IMAPClient(object): @param directory: The base directory to look for folders from. @param pattern: A pattern to match against folder names. Only folder names matching this pattern will be returned. Wildcards accepted. - @return: A list of folder names. + @return: A list of folder names. As per the return of list_folders(). ''' typ, data = self._imap.lsub(directory, pattern) self._checkok('lsub', typ, data) @@ -418,6 +429,8 @@ class IMAPClient(object): @param parts: A sequence of data items to retrieve. @return: A dictionary indexed by message number. Each item is itself a dictionary containing the requested message parts. + INTERNALDATE parts will be returned as datetime objects converted + to the local machine's time zone. ''' if not messages: return {} @@ -443,7 +456,9 @@ class IMAPClient(object): @param flags: Sequnce of message flags to set. If not specified no flags will be set. @param msg_time: Optional date and time to set for the message. The - server will set a time if it isn't specified. + server will set a time if it isn't specified. If msg_time contains + timezone information (tzinfo), this will be honoured. Otherwise the + local machine's time zone sent to the server. @type msg_time: datetime.datetime @return: The append response returned by the server. @rtype: str