view @ 5051:95a4aa0eb1e9

caching: refactored locking to separate methods, new scope='dir' scope='dir' just means: use the directory specified by arena Use .lock() and .unlock() methods together with do_locking=False to manually lock/unlock (e.g. for a locked read-modify-write cycle). With do_locking=True, .lock() is automatically called by .open(), .unlock() is automatically called by .close(). Typical usage: try:'r') # open file, create locks data = finally: cache.close() # important to close file and remove locks Removed the code that unlocks in .open()'s exception handler. Such stuff needs to be done in the caller's "finally:" block (which has to call .close(), which internally calls .unlock()). Only log IOErrors in .open() if it was for write mode. For read mode, it can be just a non-existing file, we don't want to log this case.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 29 Aug 2009 22:17:07 +0200
parents fc2f05f2b0bd
children afc6264a134f
line wrap: on
line source
#!/usr/bin/env python
    Start script for the standalone Wiki server.

    @copyright: 2007 MoinMoin:ForrestVoight
    @license: GNU GPL, see COPYING for details.

import sys, os

# a) Configuration of Python's code search path
#    If you already have set up the PYTHONPATH environment variable for the
#    stuff you see below, you don't need to do a1) and a2).

# a1) Path of the directory where the MoinMoin code package is located.
#     Needed if you installed with --prefix=PREFIX or you didn't use
#sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')

# a2) Path of the directory where / is located.
moinpath = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
sys.path.insert(0, moinpath)

# b) Configuration of moin's logging
#    If you have set up MOINLOGGINGCONF environment variable, you don't need this!
#    You also don't need this if you are happy with the builtin defaults.
#    See wiki/config/logging/... for some sample config files.
from MoinMoin import log

# Debug mode - show detailed error reports
#os.environ['MOIN_DEBUG'] = '1'

from MoinMoin.script import MoinScript

if __name__ == '__main__':
    sys.argv = ["", "server", "standalone"]