* Файл конфигурации, все секции и все ключи сделаны необязательными.
+* В файле конфигурации подставляются переменные окружения в ключах,
+ указывающих пути.
+
Version 0.1.3 (2018-05-25)
--------------------------
* Config file, all sections and all key are now completely optional.
+* Environment variables are expanded in paths in config file.
+
Version 0.1.3 (2018-05-25)
--------------------------
return default
# Do not catch ValueError here, it must be propagated
+ def getpath(self, section, option, default=os.path.curdir):
+ path = self.get(section, option, default=default)
+ return os.path.expanduser(os.path.expandvars(path))
+
def get_config(config_path=None):
global _ml_config
if lib_path is None:
global _library_path
if _library_path is None:
- _library_path = get_config().get('library', 'path') or '.'
+ _library_path = get_config().getpath('library', 'path')
lib_path = _library_path
global format, compile_format, compiled_format
@cheetah_view('download.tmpl')
def download_books():
books_ids = request.forms.getall('books')
- download_path = get_config().get('download', 'path') or '.'
+ download_path = get_config().getpath('download', 'path')
if books_ids:
for id in books_ids:
book = Book.get(int(id))
if args.get or args.get_many:
download_to = args.download_to
if download_to is None:
- download_to = get_config().get('download', 'path') \
- or os.path.curdir
+ download_to = get_config().getpath('download', 'path')
download(book, download_to, args.path, args.format)
count += 1
print_count(count)