Module mailbox :: Class _singlefileMailbox
[hide private]
[frames] | no frames]

Class _singlefileMailbox

Mailbox --+
          |
         _singlefileMailbox
Known Subclasses:

A single-file mailbox.

Instance Methods [hide private]
 
__init__(self, path, factory=None, create=True)
Initialize a single-file mailbox.
 
add(self, message)
Add message and return assigned key.
 
remove(self, key)
Remove the keyed message; raise KeyError if it doesn't exist.
 
__setitem__(self, key, message)
Replace the keyed message; raise KeyError if it doesn't exist.
 
iterkeys(self)
Return an iterator over keys.
 
has_key(self, key)
Return True if the keyed message exists, False otherwise.
 
__len__(self)
Return a count of messages in the mailbox.
 
lock(self)
Lock the mailbox.
 
unlock(self)
Unlock the mailbox if it is locked.
 
flush(self)
Write any pending changes to disk.
 
_pre_mailbox_hook(self, f)
Called before writing the mailbox to file f.
 
_pre_message_hook(self, f)
Called before writing each message to file f.
 
_post_message_hook(self, f)
Called after writing each message to file f.
 
close(self)
Flush and close the mailbox.
 
_lookup(self, key=None)
Return (start, stop) or raise KeyError.
 
_append_message(self, message)
Append message to mailbox and return (start, stop) offsets.

Inherited from Mailbox: __contains__, __delitem__, __getitem__, __iter__, clear, discard, get, get_file, get_message, get_string, items, iteritems, itervalues, keys, pop, popitem, update, values

Inherited from Mailbox (private): _dump_message

Method Details [hide private]

__init__(self, path, factory=None, create=True)
(Constructor)

 

Initialize a single-file mailbox.

Overrides: Mailbox.__init__

add(self, message)

 

Add message and return assigned key.

Overrides: Mailbox.add

remove(self, key)

 

Remove the keyed message; raise KeyError if it doesn't exist.

Overrides: Mailbox.remove

__setitem__(self, key, message)
(Index assignment operator)

 

Replace the keyed message; raise KeyError if it doesn't exist.

Overrides: Mailbox.__setitem__

iterkeys(self)

 

Return an iterator over keys.

Overrides: Mailbox.iterkeys

has_key(self, key)

 

Return True if the keyed message exists, False otherwise.

Overrides: Mailbox.has_key

__len__(self)
(Length operator)

 

Return a count of messages in the mailbox.

Overrides: Mailbox.__len__

lock(self)

 

Lock the mailbox.

Overrides: Mailbox.lock

unlock(self)

 

Unlock the mailbox if it is locked.

Overrides: Mailbox.unlock

flush(self)

 

Write any pending changes to disk.

Overrides: Mailbox.flush

close(self)

 

Flush and close the mailbox.

Overrides: Mailbox.close