filejobstore Module

A job storage using a single file per job.

class pymail.filejobstore.FileStore(name)

Bases: object

A “database” that stores “records” in files

__init__(name)

Create new FileStore object

Parameters:name (string) – directory to hold files
create(key)

Create key

Parameters:key (string) –
name = None

Directory name

path(key)

Get a path to a file

Parameters:key (string) –
class pymail.filejobstore.Job(jfile, jid)

Bases: object

Spool job

__init__(jfile, jid)

Create new Job object

Parameters:
  • jfile (file) – file open for reading and writing
  • jid (string) –
addBody(text)

Add text to body

Parameters:text (string) –

Text is considered raw. There’s no fiddling with end of lines.

addDestination(destination)

Add a destination e-mail address

Parameters:destination (string) –
addHeader(text)

Add mail message header

Parameters:text – header line; if indented, added to last header
body()

Return generator of body blocks

Returns:generator

The generator will return the message text block by block

bodyPos = None

Current file position in mail body

close()

Close job

Writes pending updates to file

commit()

Commit changes

Writes dirty data to file

done()

Remove job file

insertHeader(text)

Insert mail message header in front of list

Parameters:text – header line; if indented, added to first header
jfile = None

Store

jid = None

Job ID

load()

Load data

Resets data in memory with data from file

nextBody()

Reads next block (64KB) from body

Returns:data block

An empty string means end-of-file

resetBody()

Resets the file position for the mail body to the beginning

rollback()

Roll back changes

Does nothing in this implementation except setting status to non-dirty

setNextTry(timestamp)

Set time for next try to send mail

Parameters:timestamp – data item with a meaningful representation of a time (int, datetime.datetime etc.)
setSource(source)

Set source e-mail address

Parameters:source (string) –
class pymail.filejobstore.JobStore(name)

Bases: object

The database of spooled jobs

__init__(name)

Create new JobStore object

Parameters:name (string) – directory name
name = None

Directory name

newJob()

Create new job

Returns:Job object
store = None

File store

pymail.filejobstore.prepare(path, uid, gid)

Prepare spool directory

Parameters:
  • path (string) –
  • uid (int) –
  • gid (int) –