Skip to content

Commit

Permalink
support for more configuration files in Service.py, fixes #139
Browse files Browse the repository at this point in the history
  • Loading branch information
jachym committed Jun 29, 2016
1 parent d571361 commit 6804178
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions pywps/app/Service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class Service(object):
:param processes: A list of :class:`~Process` objects that are
provided by this service.
:param cfgfiles: A list of configuration files
"""

def __init__(self, processes=[], cfgfile=None):
def __init__(self, processes=[], cfgfiles=None):
self.processes = {p.identifier: p for p in processes}

if cfgfile:
config.load_configuration(cfgfile)
if cfgfiles:
config.load_configuration(cfgfiles)

if config.get_config_value('server', 'logfile') and config.get_config_value('server', 'loglevel'):
LOGGER.setLevel(getattr(logging, config.get_config_value('server', 'loglevel')))
Expand Down
6 changes: 4 additions & 2 deletions pywps/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def load_configuration(cfgfiles=None):
"""Load PyWPS configuration from configuration files.
The later configuration file in the array overwrites configuration
from the first.
:param cfgfiles: list of configuration files
"""

global config
Expand Down Expand Up @@ -130,8 +132,8 @@ def load_configuration(cfgfiles=None):
if not cfgfiles:
cfgfiles = _get_default_config_files_location()

if type(cfgfiles) != type(()):
cfgfiles = (cfgfiles)
if isinstance(cfgfiles, str):
cfgfiles = [cfgfiles]

loaded_files = config.read(cfgfiles)
if loaded_files:
Expand Down
2 changes: 1 addition & 1 deletion wsgi/pywps.wsgi
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ processes = [
Area()
]

application = Service(processes, '/var/www/pywps/pywps.cfg')
application = Service(processes, ['/var/www/pywps/pywps.cfg'])

0 comments on commit 6804178

Please sign in to comment.