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

Module utils

source code

Mostly utility functions Lamson uses internally that don't really belong anywhere else in the modules. This module is kind of a dumping ground, so if you find something that can be improved feel free to work up a patch.

Functions [hide private]
 
import_settings(boot_also, from_dir=None, boot_module='config.boot')
Used to import the settings in a Lamson project.
source code
 
daemonize(pid, chdir, chroot, umask, files_preserve=None, do_open=True)
Uses python-daemonize to do all the junk needed to make a server a server.
source code
 
drop_priv(uid, gid)
Changes the uid/gid to the two given, you should give utils.daemonize 0,0 for the uid,gid so that it becomes root, which will allow you to then do this.
source code
 
make_fake_settings(host, port)
When running as a logging server we need a fake settings module to work with since the logging server can be run in any directory, so there may not be a config/settings.py file to import.
source code
 
check_for_pid(pid, force)
Checks if a pid file is there, and if it is sys.exit.
source code
 
start_server(pid, force, chroot, chdir, uid, gid, umask, settings_loader)
Starts the server by doing a daemonize and then dropping priv accordingly.
source code
Variables [hide private]
  __package__ = 'lamson'
Function Details [hide private]

import_settings(boot_also, from_dir=None, boot_module='config.boot')

source code 

Used to import the settings in a Lamson project.

daemonize(pid, chdir, chroot, umask, files_preserve=None, do_open=True)

source code 

Uses python-daemonize to do all the junk needed to make a server a server. It supports all the features daemonize has, except that chroot probably won't work at all without some serious configuration on the system.

drop_priv(uid, gid)

source code 

Changes the uid/gid to the two given, you should give utils.daemonize 0,0 for the uid,gid so that it becomes root, which will allow you to then do this.

make_fake_settings(host, port)

source code 

When running as a logging server we need a fake settings module to work with since the logging server can be run in any directory, so there may not be a config/settings.py file to import.

check_for_pid(pid, force)

source code 

Checks if a pid file is there, and if it is sys.exit. If force given then it will remove the file and not exit if it's there.

start_server(pid, force, chroot, chdir, uid, gid, umask, settings_loader)

source code 

Starts the server by doing a daemonize and then dropping priv accordingly. It will only drop to the uid/gid given if both are given.


Variables Details [hide private]

__package__

Value:
'lamson'