From 6a6fbe6c1b5f663ad7adf6a66d16c354214f9d57 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 16 Nov 2021 15:49:47 +0100 Subject: fix debian packaging --- src/pydrilla/development_config.json | 24 ------------------------ src/pydrilla/pydrilla.py | 7 +++++-- 2 files changed, 5 insertions(+), 26 deletions(-) delete mode 100644 src/pydrilla/development_config.json (limited to 'src/pydrilla') diff --git a/src/pydrilla/development_config.json b/src/pydrilla/development_config.json deleted file mode 100644 index 1660edb..0000000 --- a/src/pydrilla/development_config.json +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: CC0-1.0 - -// Hydrilla development config file. -// -// Copyright (C) 2021 Wojtek Kosior -// -// Available under the terms of Creative Commons Zero v1.0 Universal. - -// this config is meant to be used in development environment; -// unlike config.json, it shall not be included in distribution -{ - "content_dir": "./example_content", - - // Except files from content_dir to be served there (used to redirect - // clients). - "static_resource_uri": "http://localhost:8000/", - - // Make Pydrilla error out on any warning - "werror": true - - // With the below we can make Pydrilla look for missing content items in - // another instance instead of just erroring/warning. - // ,"hydrilla_parent": "https://api.hachette-hydrilla.org/0.2/" -} diff --git a/src/pydrilla/pydrilla.py b/src/pydrilla/pydrilla.py index 239267e..2c4ad0d 100644 --- a/src/pydrilla/pydrilla.py +++ b/src/pydrilla/pydrilla.py @@ -541,7 +541,6 @@ def load_content_from_subdir(subdir_path, source_name, content): content.process_index(index, source_name) def load_content(path): - path = pathlib.Path(path) if not path.is_dir(): raise ValueError(_('content_dir_path_not_dir')) @@ -586,8 +585,12 @@ def create_app(config_path=(here / 'config.json'), flask_config={}): app._pydrilla_werror = config.get('werror', False) if 'hydrilla_parent' in config: raise MyNotImplError('hydrilla_parent', config_path.name) + + content_dir = pathlib.Path(config['content_dir']) + if not content_dir.is_absolute(): + content_dir = config_path.parent / content_dir with app.app_context(): - app._pydrilla_content = load_content(config['content_dir']) + app._pydrilla_content = load_content(content_dir.resolve()) app.register_blueprint(bp) -- cgit v1.2.3