The unified diff between revisions [f8db548c..] and [b5d299ba..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'viewmtn.py'
#
#
# patch "viewmtn.py"
# from [74a4f0416cdabd92532bb1ed2f1a6fbe7f52183f]
# to [4711109e7e0e383a480fde9fae671de24ce92401]
#
============================================================
--- viewmtn.py 74a4f0416cdabd92532bb1ed2f1a6fbe7f52183f
+++ viewmtn.py 4711109e7e0e383a480fde9fae671de24ce92401
@@ -9,7 +9,7 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.
-import os, sys, urllib
+import os, sys, urllib, types
from itertools import izip, chain, repeat
from urlparse import urljoin
import web
@@ -54,7 +54,14 @@ class RequestContextFactory(object):
self.default = None
# has the user specified a dbfiles hash? if so, use it
if hasattr (config, "dbfiles"):
- for name, dbfile, description in grouper(3, config.dbfiles):
+ # is dbfiles a function? if so, call it..
+ dbfiles = config.dbfiles
+ if isinstance(dbfiles, types.FunctionType):
+ dbfiles = dbfiles()
+ # we should have something iterable now; if not, abort
+ if not hasattr(dbfiles, "__iter__"):
+ raise Exception("dbfiles defined incorrectly. It must be an interable (eg. tuple or list) or a function taking no arguments which returns an iterable.")
+ for name, dbfile, description in grouper(3, dbfiles):
self.add_to_store(name, ops=mtn.Operations([config.monotone, dbfile]),
branchdivs=branchdiv.BranchDivisions(),
dbdescr=description)