summaryrefslogtreecommitdiff
path: root/alot/helper.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-03-11 13:55:47 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2012-03-11 13:55:47 +0000
commit1b1f7465b5c8a3d8a295247559d77c2e9a591dd8 (patch)
tree2ddec4045ed8346aa557d14babfed7d87a277f88 /alot/helper.py
parent9b8c0dd28b4bfa755ddf1470b698b863969edca8 (diff)
parentcc0a67526088df5626be6e6567e3fb5788ec84b4 (diff)
Merge branch 'mbox-check-404' into testing
Diffstat (limited to 'alot/helper.py')
-rw-r--r--alot/helper.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/alot/helper.py b/alot/helper.py
index 56250c71..7588e5aa 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -401,7 +401,7 @@ def humanize_size(size):
return format_string % (size / factor)
-def read_config(configpath=None, specpath=None):
+def read_config(configpath=None, specpath=None, checks={}):
"""
get a (validated) config object for given config file path.
@@ -409,6 +409,9 @@ def read_config(configpath=None, specpath=None):
:type configpath: str
:param specpath: path to spec-file
:type specpath: str
+ :param checks: custom checks to use for validator.
+ see `validate docs <http://www.voidspace.org.uk/python/validate.html>`_
+ :type checks: dict str->callable,
:rtype: `configobj.ConfigObj`
"""
try:
@@ -419,6 +422,7 @@ def read_config(configpath=None, specpath=None):
if specpath:
validator = Validator()
+ validator.functions.update(checks)
results = config.validate(validator)
if results != True: