ACC SHELL
Path : /usr/lib/python/ |
|
Current File : //usr/lib/python/mhlib.pyo |
oMc @ s~ d Z d d k l Z e d d d [ d Z d Z d Z d Z d d
k Z d d
k Z d d
k Z d d
k
Z
d d
k Z d d
k Z d d k
l
Z
d d
d d g Z d
e f d YZ d f d YZ e i d Z d Z d f d YZ d e
i f d YZ d e f d YZ d f d YZ d d Z d d Z d Z e d j o e n d
S( s MH interface -- purely object-oriented (well, almost)
Executive summary:
import mhlib
mh = mhlib.MH() # use default mailbox directory and profile
mh = mhlib.MH(mailbox) # override mailbox location (default from profile)
mh = mhlib.MH(mailbox, profile) # override mailbox and profile
mh.error(format, ...) # print error message -- can be overridden
s = mh.getprofile(key) # profile entry (None if not set)
path = mh.getpath() # mailbox pathname
name = mh.getcontext() # name of current folder
mh.setcontext(name) # set name of current folder
list = mh.listfolders() # names of top-level folders
list = mh.listallfolders() # names of all folders, including subfolders
list = mh.listsubfolders(name) # direct subfolders of given folder
list = mh.listallsubfolders(name) # all subfolders of given folder
mh.makefolder(name) # create new folder
mh.deletefolder(name) # delete folder -- must have no subfolders
f = mh.openfolder(name) # new open folder object
f.error(format, ...) # same as mh.error(format, ...)
path = f.getfullname() # folder's full pathname
path = f.getsequencesfilename() # full pathname of folder's sequences file
path = f.getmessagefilename(n) # full pathname of message n in folder
list = f.listmessages() # list of messages in folder (as numbers)
n = f.getcurrent() # get current message
f.setcurrent(n) # set current message
list = f.parsesequence(seq) # parse msgs syntax into list of messages
n = f.getlast() # get last message (0 if no messagse)
f.setlast(n) # set last message (internal use only)
dict = f.getsequences() # dictionary of sequences in folder {name: list}
f.putsequences(dict) # write sequences back to folder
f.createmessage(n, fp) # add message from file f as number n
f.removemessages(list) # remove messages in list from folder
f.refilemessages(list, tofolder) # move messages in list to other folder
f.movemessage(n, tofolder, ton) # move one message to a given destination
f.copymessage(n, tofolder, ton) # copy one message to a given destination
m = f.openmessage(n) # new open message object (costs a file descriptor)
m is a derived class of mimetools.Message(rfc822.Message), with:
s = m.getheadertext() # text of message's headers
s = m.getheadertext(pred) # text of message's headers, filtered by pred
s = m.getbodytext() # text of message's body, decoded
s = m.getbodytext(0) # text of message's body, not decoded
i( t warnpy3ksO the mhlib module has been removed in Python 3.0; use the mailbox module insteadt
stackleveli s
~/.mh_profiles ~/Mails
.mh_sequencesi N( t bisectt MHt Errort Foldert Messagec B s e Z RS( ( t __name__t
__module__( ( ( s /usr/lib/python2.6/mhlib.pyR [ s c B s e Z d Z d d d Z d Z d Z d Z d Z d Z d Z
d Z d Z d
Z
d Z d Z d
Z d Z RS( s< Class representing a particular collection of folders.
Optional constructor arguments are the pathname for the directory
containing the collection, and the MH profile to use.
If either is omitted or empty a default is used; the default
directory is taken from the MH profile if it is specified there.c C s | d j o
t } n t i i | | _ | d j o | i d } n | p
t } n t i i | o* | d d j o t i i d | } n t i i | } t i i
| p
t d n | | _ d S( s Constructor.t Pathi t ~s MH() path not foundN( t Nonet
MH_PROFILEt ost patht
expandusert profilet
getprofilet PATHt isabst joint isdirR ( t selfR R ( ( s /usr/lib/python2.6/mhlib.pyt __init__f s
%
c C s d | i | i f S( s String representation.s
MH(%r, %r)( R R ( R ( ( s /usr/lib/python2.6/mhlib.pyt __repr__r s c G s t i i d | | d S( sA Routine to print an error. May be overridden by a derived class.s
MH error: %s
N( t syst stderrt write( R t msgt args( ( s /usr/lib/python2.6/mhlib.pyt errorv s c C s t | i | S( s* Return a profile entry, None if not found.( t picklineR ( R t key( ( s /usr/lib/python2.6/mhlib.pyR z s c C s | i S( s9 Return the path (the name of the collection's directory).( R ( R ( ( s /usr/lib/python2.6/mhlib.pyt getpath~ s c C s9 t t i i | i d d } | p
d } n | S( s&