Skip to content

Commit 2540bdc

Browse files
authored
Merge pull request #426 from mvdbeek/avoid_pastescript_for_config_parsing
Avoid pastescript for config file parsing
2 parents 0789152 + 8152440 commit 2540bdc

10 files changed

Lines changed: 17 additions & 1879 deletions

File tree

.coveragerc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
[run]
33
branch = True
44
include = pulsar/*
5-
omit = pulsar/util/pastescript/*
65

76
[report]
87
# Regexes for lines to exclude from consideration

docs/pulsar.util.pastescript.rst

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/pulsar.util.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
pulsar.util package
22
===================
33

4-
Subpackages
5-
-----------
6-
7-
.. toctree::
8-
:maxdepth: 4
9-
10-
pulsar.util.pastescript
11-
124
Module contents
135
---------------
146

pulsar/main.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,19 @@ def load_app_configuration(ini_path=None, app_conf_path=None, app_name=None, loc
200200
"""
201201
"""
202202
if ini_path and local_conf is None:
203-
from pulsar.util.pastescript.loadwsgi import ConfigLoader
204-
local_conf = ConfigLoader(ini_path).app_context(app_name).config()
203+
# Simple ini parsing without loadwsgi dependencies
204+
ini_path_abs = os.path.abspath(ini_path)
205+
defaults = {
206+
'here': os.path.dirname(ini_path_abs),
207+
'__file__': ini_path_abs
208+
}
209+
config = configparser.ConfigParser(defaults=defaults)
210+
config.read(ini_path)
211+
section_name = f"app:{app_name}"
212+
if config.has_section(section_name):
213+
local_conf = dict(config.items(section_name))
214+
else:
215+
local_conf = {}
205216
local_conf = local_conf or {}
206217
local_conf['config_dir'] = config_dir
207218
if app_conf_path is None and "app_config" in local_conf:

pulsar/util/pastescript/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)