Skip to content

Commit

Permalink
don't lose config if provided directly (bird-house#69)
Browse files Browse the repository at this point in the history
fmigneault committed May 16, 2019
1 parent 89d8c03 commit 54aae25
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions twitcher/adapter/base.py
Original file line number Diff line number Diff line change
@@ -24,8 +24,8 @@ def describe_adapter(self):
"""
raise NotImplementedError

def configurator_factory(self, request):
# type: (Request) -> Configurator
def configurator_factory(self, container):
# type: (AnySettingsContainer) -> Configurator
"""
Returns the 'configurator' implementation of the adapter.
"""
@@ -52,8 +52,8 @@ def owssecurity_factory(self, request):
"""
raise NotImplementedError

def owsproxy_config(self, request):
# type: (Request) -> None
def owsproxy_config(self, config):
# type: (AnySettingsContainer) -> None
"""
Returns the 'owsproxy' implementation of the adapter.
"""
12 changes: 7 additions & 5 deletions twitcher/adapter/default.py
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@ def describe_adapter(self):
from twitcher.__version__ import __version__
return {"name": "default", "version": str(__version__)}

def configurator_factory(self, request):
settings = get_settings(request)
def configurator_factory(self, container):
settings = get_settings(container)
return Configurator(settings=settings)

def tokenstore_factory(self, request):
@@ -30,7 +30,9 @@ def owssecurity_factory(self, request):
service_store = self.servicestore_factory(request)
return OWSSecurity(token_store, service_store)

def owsproxy_config(self, request):
def owsproxy_config(self, container):
from twitcher.owsproxy import owsproxy_defaultconfig
config = self.configurator_factory(request)
owsproxy_defaultconfig(config)
# update provided config or generate it otherwise
if not isinstance(container, Configurator):
container = self.configurator_factory(container)
owsproxy_defaultconfig(container)

0 comments on commit 54aae25

Please sign in to comment.