Package lamson :: Module commands
[hide private]
[frames] | no frames]

Module commands

source code

Implements the Lamson command line tool's commands, which are run by the lamson.args module dynamically. Each command has it's actual user displayed command line documentation as the __doc__ string.

You will notice that all of the command functions in this module end in _command. This is not required by the lamson.args module but it is the default. You could easily use any other suffix, or none at all.

This is done to disambiguate the command that it implements so that your command line tools do not clash with Python's reserved words and built-ins. With this design you can have a list_command without clashing with list().

You will also notice that commands which take trailing positional arguments give a TRAILING=[] or TRAILING=None (if it's required). This is done instead of *args because we need to use None to indicate that this command requires positional arguments. TRAILING=[] is like saying they are optional (but expected), and TRAILING=None is like saying they are required. You can't (afaik) do TRAILING=None with *args.

See lamson.args for more details.

Functions [hide private]
 
log_command(port=8825, host='127.0.0.1', chroot=False, chdir='.', uid=False, gid=False, umask=False, pid='./run/log.pid', FORCE=False)
Runs a logging only server on the given hosts and port.
source code
 
send_command(port=8825, host='127.0.0.1', username=False, password=False, ssl=False, starttls=False, debug=1, sender=None, to=None, subject=None, body=None, attach=False)
Sends an email to someone as a test message.
source code
 
sendmail_command(port=8825, host='127.0.0.1', debug=0, TRAILING=None)
Used as a testing sendmail replacement for use in programs like mutt as an MTA.
source code
 
start_command(pid='./run/smtp.pid', FORCE=False, chroot=False, chdir='.', boot='config.boot', uid=False, gid=False, umask=False)
Runs a lamson server out of the current directory:
source code
 
stop_command(pid='./run/smtp.pid', KILL=False, ALL=False)
Stops a running lamson server.
source code
 
restart_command(**options)
Simply attempts a stop and then a start command.
source code
 
status_command(pid='./run/smtp.pid')
Prints out status information about lamson useful for finding out if it's running and where.
source code
 
help_command(**options)
Prints out help for the commands.
source code
 
queue_command(pop=False, get=False, keys=False, remove=False, count=False, clear=False, name='run/queue')
Let's you do most of the operations available to a queue.
source code
 
routes_command(TRAILING=['config.testing'], path='/home/zedshaw/projects/lamson', test='')
Prints out valuable information about an application's routing configuration after everything is loaded and ready to go.
source code
 
gen_command(project=None, FORCE=False)
Generates various useful things for you to get you started.
source code
 
web_command(basedir='.', port=8888, host='127.0.0.1')
Starts a very simple files only web server for easy testing of applications that need to make some HTML files as the result of their operation.
source code
 
cleanse_command(input=None, output=None)
Uses Lamson mail cleansing and canonicalization system to take an input maildir (or mbox) and replicate the email over into another maildir.
source code
 
blast_command(input=None, host='127.0.0.1', port=8823, debug=0)
Given a maildir, this command will go through each email and blast it at your server.
source code
 
version_command()
Prints the version of Lamson, the reporitory revision, and the file it came from.
source code
Variables [hide private]
  __package__ = 'lamson'
Function Details [hide private]

log_command(port=8825, host='127.0.0.1', chroot=False, chdir='.', uid=False, gid=False, umask=False, pid='./run/log.pid', FORCE=False)

source code 

Runs a logging only server on the given hosts and port.  It logs
each message it receives and also stores it to the run/queue 
so that you can make sure it was received in testing.

lamson log -port 8825 -host 127.0.0.1 \
        -pid ./run/log.pid -chroot False  \
        -chdir "." -umask False -uid False -gid False \
        -FORCE False

If you specify a uid/gid then this means you want to first change to
root, set everything up, and then drop to that UID/GID combination.
This is typically so you can bind to port 25 and then become "safe"
to continue operating as a non-root user.

If you give one or the other, this it will just change to that
uid or gid without doing the priv drop operation.

send_command(port=8825, host='127.0.0.1', username=False, password=False, ssl=False, starttls=False, debug=1, sender=None, to=None, subject=None, body=None, attach=False)

source code 

Sends an email to someone as a test message.
See the sendmail command for a sendmail replacement.

lamson send -port 8825 -host 127.0.0.1 -debug 1 \
        -sender EMAIL -to EMAIL -subject STR -body STR -attach False'

There is also a username, password, and starttls option for those 
who need it.

sendmail_command(port=8825, host='127.0.0.1', debug=0, TRAILING=None)

source code 

Used as a testing sendmail replacement for use in programs like mutt as an MTA. It reads the email to send on the stdin and then delivers it based on the port and host settings.

lamson sendmail -port 8825 -host 127.0.0.1 -debug 0 -- [recipients]

start_command(pid='./run/smtp.pid', FORCE=False, chroot=False, chdir='.', boot='config.boot', uid=False, gid=False, umask=False)

source code 

Runs a lamson server out of the current directory:

lamson start -pid ./run/smtp.pid -FORCE False -chroot False -chdir "." \
        -umask False -uid False -gid False -boot config.boot

stop_command(pid='./run/smtp.pid', KILL=False, ALL=False)

source code 

Stops a running lamson server. Give -KILL True to have it stopped violently. The PID file is removed after the signal is sent. Give -ALL the name of a run directory and it will stop all pid files it finds there.

lamson stop -pid ./run/smtp.pid -KILL False -ALL False

restart_command(**options)

source code 

Simply attempts a stop and then a start command. All options for both apply to restart. See stop and start for options available.

status_command(pid='./run/smtp.pid')

source code 

Prints out status information about lamson useful for finding out if it's running and where.

lamson status -pid ./run/smtp.pid

help_command(**options)

source code 

Prints out help for the commands.

lamson help

You can get help for one command with:

lamson help -for STR

queue_command(pop=False, get=False, keys=False, remove=False, count=False, clear=False, name='run/queue')

source code 

Let's you do most of the operations available to a queue.

lamson queue (-pop | -get | -remove | -count | -clear | -keys) -name run/queue

routes_command(TRAILING=['config.testing'], path='/home/zedshaw/projects/lamson', test='')

source code 

Prints out valuable information about an application's routing configuration after everything is loaded and ready to go. Helps debug problems with messages not getting to your handlers. Path has the search paths you want separated by a ':' character, and it's added to the sys.path.

lamson routes -path $PWD -- config.testing -test ""

It defaults to running your config.testing to load the routes. If you want it to run the config.boot then give that instead:

lamson routes -- config.boot

You can also test a potential target by doing -test EMAIL.

gen_command(project=None, FORCE=False)

source code 

Generates various useful things for you to get you started.

lamson gen -project STR -FORCE False

web_command(basedir='.', port=8888, host='127.0.0.1')

source code 

Starts a very simple files only web server for easy testing of applications that need to make some HTML files as the result of their operation. If you need more than this then use a real web server.

lamson web -basedir "." -port 8888 -host '127.0.0.1'

This command doesn't exit so you can view the logs it prints out.

cleanse_command(input=None, output=None)

source code 

Uses Lamson mail cleansing and canonicalization system to take an input maildir (or mbox) and replicate the email over into another maildir. It's used mostly for testing and cleaning.

blast_command(input=None, host='127.0.0.1', port=8823, debug=0)

source code 

Given a maildir, this command will go through each email and blast it at your server. It does nothing to the message, so it will be real messages hitting your server, not cleansed ones.

version_command()

source code 

Prints the version of Lamson, the reporitory revision, and the file it came from.


Variables Details [hide private]

__package__

Value:
'lamson'