paul@1069 | 1 | #!/usr/bin/env python |
paul@1069 | 2 | |
paul@1069 | 3 | """ |
paul@1069 | 4 | General support for calendar data storage. |
paul@1069 | 5 | |
paul@1206 | 6 | Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> |
paul@1069 | 7 | |
paul@1069 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@1069 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@1069 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@1069 | 11 | version. |
paul@1069 | 12 | |
paul@1069 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@1069 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@1069 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@1069 | 16 | details. |
paul@1069 | 17 | |
paul@1069 | 18 | You should have received a copy of the GNU General Public License along with |
paul@1069 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@1069 | 20 | """ |
paul@1069 | 21 | |
paul@1206 | 22 | from imiptools.stores.manifest import stores |
paul@1071 | 23 | |
paul@1088 | 24 | # Access functions. |
paul@1069 | 25 | |
paul@1088 | 26 | def get_store(store_type, store_dir): |
paul@1285 | 27 | |
paul@1285 | 28 | """ |
paul@1285 | 29 | Return a store for the given 'store_type' and 'store_dir'. If 'store_dir' |
paul@1285 | 30 | is given as a null or false value then the configured default is used. |
paul@1285 | 31 | """ |
paul@1285 | 32 | |
paul@1088 | 33 | return stores[store_type].Store(store_dir) |
paul@1069 | 34 | |
paul@1088 | 35 | def get_publisher(publishing_dir): |
paul@1285 | 36 | |
paul@1285 | 37 | """ |
paul@1285 | 38 | Return a publishing resource employing 'publishing_dir'. If the specified |
paul@1285 | 39 | directory is given as a null or false value, None is returned. Thus, all |
paul@1285 | 40 | free/busy publishing can be disabled by changing the configuration to use |
paul@1285 | 41 | None as the directory. |
paul@1285 | 42 | """ |
paul@1285 | 43 | |
paul@1285 | 44 | return publishing_dir and stores["file"].Publisher(publishing_dir) or None |
paul@1069 | 45 | |
paul@1088 | 46 | def get_journal(store_type, journal_dir): |
paul@1285 | 47 | |
paul@1285 | 48 | """ |
paul@1285 | 49 | Return a journal for the given 'store_type' and 'journal_dir'. If |
paul@1285 | 50 | 'journal_dir' is given as a null or false value then the configured default |
paul@1285 | 51 | is used. |
paul@1285 | 52 | """ |
paul@1285 | 53 | |
paul@1088 | 54 | return stores[store_type].Journal(journal_dir) |
paul@1069 | 55 | |
paul@1069 | 56 | # vim: tabstop=4 expandtab shiftwidth=4 |