]> khamidou — GitHub mirrors - imapclient.git/commitdiff
merged changes from another documentation working copy
authorMenno Smits <menno@freshfoo.com>
Sat, 19 Feb 2011 23:19:50 +0000 (23:19 +0000)
committerMenno Smits <menno@freshfoo.com>
Sat, 19 Feb 2011 23:19:50 +0000 (23:19 +0000)
doc-src/index.rst
imapclient/imapclient.py

index dfd0ebe57406b23d3649aa9cbd95714fbf2466c8..180e816401ba692b8cea92306d7068a35e3a4ec3 100644 (file)
@@ -1,8 +1,3 @@
-.. IMAPClient documentation master file, created by
-   sphinx-quickstart on Fri Oct  1 12:26:06 2010.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
-
 IMAPClient
 ==========
 
@@ -11,11 +6,21 @@ IMAPClient
 
 Introduction
 ------------
-A Pythonic, easy-to-use IMAP client class.
+A Pythonic, easy-to-use IMAP client package.
+
+Although IMAPClient actually uses the imaplib module from the Python
+standard library under the hood, it provides a different API. Instead
+of requiring that the caller performs extra parsing work, return
+values are full parsed, readily usable and use sensible Python
+types. Exceptions are raised when problems occur (no error checking of
+return values is required).
 
-Unlike imaplib, arguments and returns values are Pythonic and readily
-usable. Exceptions are raised when problems occur (no error checking
-of return values is required).
+MAPClient is straight forward it use, but it can be useful to have at
+least a general understanding of the IMAP protocol. `RFC3501
+<http://www.faqs.org/rfcs/rfc3501.html>`_ explains IMAP in
+detail. Other RFCs also apply to various extensions to the base
+protocol. These are referred to in the documentation below where
+relevant.
 
 A Simple Example
 ----------------
@@ -23,8 +28,64 @@ A Simple Example
 
 XXX include some simple output
 
+Concepts
+--------
+
+Message Identifiers
+~~~~~~~~~~~~~~~~~~~
+There are two ways to refer to messages using the IMAP protocol. 
+
+One way is by message sequence number where the messages in a mailbox
+are numbered from 1 to N where N is the number of messages. These
+numbers don't persist between sessions and may be reassigned after
+some operations such as a folder expunge.
+
+XXX explain UIDs
+
+XXX rework below
+Message unique identifiers (UID) can be used with any call. The use_uid
+argument to the constructor and the use_uid attribute control whether UIDs
+are used.
+
+Any method that accepts message id's takes either a sequence containing
+message IDs (eg. [1,2,3]) or a single message ID as an integer.
+
+Message Flags
+~~~~~~~~~~~~~
+Any method that accepts message flags takes either a sequence containing
+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.
+
+Folder Name Encoding
+~~~~~~~~~~~~~~~~~~~~
+XXX 
+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.
+
+XXX check FPNP for more ideas on what should go in here
+
+Exceptions
+~~~~~~~~~~
+The IMAP related exceptions that will be raised by this class are:
+
+* IMAPClient.Error
+* IMAPClient.AbortError
+* IMAPClient.ReadOnlyError
+
+These are aliases for the imaplib.IMAP4 exceptions of the same name. Socket
+errors may also be raised in the case of network errors.
+
 IMAPClient Class Reference
 --------------------------
+The primary class used by the imapclient package is the IMAPClient
+class. All interaction with a remote IMAP server is performed via an
+IMAPClient instance.
+
 .. autoclass:: imapclient.IMAPClient
    :members:
 
index 319ed60608496b00aed181ce42f18aa3254412d0..7aae1eb3b38bd8c61c22b1bf255e3d270d861a62 100644 (file)
@@ -31,33 +31,17 @@ RECENT = r'\Recent'         # This flag is read-only
 
 
 class IMAPClient(object):
-    #XXX concepts to cover: UIDs, message lists, folder encoding, exceptions
     """
-    Message unique identifiers (UID) can be used with any call. The use_uid
-    argument to the constructor and the use_uid attribute control whether UIDs
-    are used.
-
-    Any method that accepts message id's takes either a sequence containing
-    message IDs (eg. [1,2,3]) or a single message ID as an integer.
-
-    Any method that accepts message flags takes either a sequence containing
-    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
-        IMAPClient.ReadOnlyError
-    These are aliases for the imaplib.IMAP4 exceptions of the same name. Socket
-    errors may also be raised in the case of network errors.
+    A connection to the IMAP server specified by *host* is made when
+    the class is instantiated.
+
+    *port* defaults to 143, or 993 if *ssl* is ``True``.
+
+    If *use_uid* is ``True`` unique message UIDs be used for all calls
+    that accept message ids (defaults to ``True``).
+
+    If *ssl* is ``True`` an SSL connection will be made (defaults to
+    ``False``).
     """
 
     Error = imaplib.IMAP4.error
@@ -69,13 +53,6 @@ class IMAPClient(object):
                            r'\((?P<status_items>.*)\)$')
 
     def __init__(self, host, port=None, use_uid=True, ssl=False):
-        """Initialise object instance and connect to the remote IMAP server.
-
-        @param host: The IMAP server address/hostname to connect to.
-        @param port: The port number to use (default is 143, 993 for SSL).
-        @param use_uid: Should message UIDs be used (default is True).
-        @param ssl: Make an SSL connection (default is False)
-        """
         if ssl:
             ImapClass = imaplib.IMAP4_SSL
             default_port = 993
@@ -115,7 +92,7 @@ class IMAPClient(object):
 
 
     def has_capability(self, capability):
-        """Return True if the server has the *capability* specified.
+        """Return ``True`` if the IMAP server has the given *capability*.
         """
         # FIXME: this will not detect capabilities that are backwards
         # compatible with the current level. For instance the SORT