1.1 --- a/imiptools/stores/__init__.py Tue Oct 17 17:16:36 2017 +0200
1.2 +++ b/imiptools/stores/__init__.py Tue Oct 17 22:24:09 2017 +0200
1.3 @@ -19,17 +19,39 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 +from imiptools.config import settings
1.8 from imiptools.stores.manifest import stores
1.9
1.10 # Access functions.
1.11
1.12 -def get_store(store_type, store_dir):
1.13 - return stores[store_type].Store(store_dir)
1.14 +def get_store(store_type=None, store_dir=None):
1.15 +
1.16 + """
1.17 + Return a store object for the given 'store_type' and 'store_dir', using
1.18 + configuration defaults where the parameters are given as None.
1.19 + """
1.20 +
1.21 + return stores[store_type or settings["STORE_TYPE"]].Store(
1.22 + store_dir or settings["STORE_DIR"])
1.23 +
1.24 +def get_publisher(publishing_dir=None):
1.25
1.26 -def get_publisher(publishing_dir):
1.27 - return stores["file"].Publisher(publishing_dir)
1.28 + """
1.29 + Return a publisher object for the given 'publishing_dir', using
1.30 + configuration defaults where the parameter is given as None.
1.31 + """
1.32 +
1.33 + return stores["file"].Publisher(
1.34 + publishing_dir or settings["PUBLISHING_DIR"])
1.35
1.36 -def get_journal(store_type, journal_dir):
1.37 - return stores[store_type].Journal(journal_dir)
1.38 +def get_journal(store_type=None, journal_dir=None):
1.39 +
1.40 + """
1.41 + Return a journal object for the given 'store_type' and 'journal_dir', using
1.42 + configuration defaults where the parameters are given as None.
1.43 + """
1.44 +
1.45 + return stores[store_type or settings["STORE_TYPE"]].Journal(
1.46 + journal_dir or settings["JOURNAL_DIR"])
1.47
1.48 # vim: tabstop=4 expandtab shiftwidth=4