viewmtn/viewmtn.conf.py
2008-03-23 20:13:29 +00:00

28 lines
775 B
Python

#
# See __python_sitelib__/viewmtn/config.py,
# which imports this file.
# You can override any of the settings in that file here to customize.
#
# For viewmtn to work at all, it must have a definition for dbfile or dbfiles.
# These can be a simple constants configured here, or Python code here
# can set them dynamically.
#
import os.path
import glob
def _flatten_tuples(l):
return reduce(tuple.__add__, l, ())
def _dbfile_tuple(file):
dir = os.path.dirname(file)
name = os.path.basename(dir)
description = None
try:
description = open(os.path.join(dir, 'description')).read()
except IOError:
pass
return (name, file, description)
def dbfiles():
return _flatten_tuples(map(_dbfile_tuple, glob.glob('/srv/mtn/*/db.mtn')))