Skip to content

Commit

Permalink
Include capakey by default (#93)
Browse files Browse the repository at this point in the history
Closes-Issue: #46
  • Loading branch information
Wim-De-Clercq authored and claeyswo committed Dec 18, 2018
1 parent ebdee07 commit 731c311
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
26 changes: 14 additions & 12 deletions crabpy_pyramid/__init__.py
Expand Up @@ -118,7 +118,7 @@ def _build_crab(registry, settings):
gateway = CrabGateway(factory, cache_config=cache_config)

registry.registerUtility(gateway, ICrab)
return registry.queryUtility(ICapakey)
return registry.queryUtility(ICrab)


def get_capakey(registry):
Expand Down Expand Up @@ -218,17 +218,19 @@ def includeme(config):
if not os.path.exists(root):
os.makedirs(root)

capakey_settings = dict(_filter_settings(settings, 'capakey.'), **base_settings)
if capakey_settings['include']:
log.info('Adding CAPAKEY Gateway.')
del capakey_settings['include']
config.add_renderer('capakey_listjson', capakey_json_list_renderer)
config.add_renderer('capakey_itemjson', capakey_json_item_renderer)
_build_capakey(config.registry, capakey_settings)
config.add_request_method(get_capakey, 'capakey_gateway')
config.add_directive('get_capakey', get_capakey)
config.include('crabpy_pyramid.routes.capakey')
config.scan('crabpy_pyramid.views.capakey')
capakey_settings = dict(_filter_settings(settings, 'capakey.'),
**base_settings)
if 'include' in capakey_settings:
log.info("The 'capakey.include' setting is deprecated. Capakey will "
"always be included.")
log.info('Adding CAPAKEY Gateway.')
config.add_renderer('capakey_listjson', capakey_json_list_renderer)
config.add_renderer('capakey_itemjson', capakey_json_item_renderer)
_build_capakey(config.registry, capakey_settings)
config.add_request_method(get_capakey, 'capakey_gateway')
config.add_directive('get_capakey', get_capakey)
config.include('crabpy_pyramid.routes.capakey')
config.scan('crabpy_pyramid.views.capakey')

crab_settings = dict(_filter_settings(settings, 'crab.'), **base_settings)
if crab_settings['include']:
Expand Down
1 change: 0 additions & 1 deletion crabpy_pyramid/tests/test_functional.py
Expand Up @@ -40,7 +40,6 @@ def run_crab_integration_tests():

settings = {
'crabpy.cache.file.root': os.path.join(os.path.dirname(__file__), 'dogpile_data'),
'crabpy.capakey.include': True,
'crabpy.capakey.cache_config.permanent.backend': 'dogpile.cache.dbm',
'crabpy.capakey.cache_config.permanent.expiration_time': 604800,
'crabpy.capakey.cache_config.permanent.arguments.filename': os.path.join(os.path.dirname(__file__), 'dogpile_data', 'capakey_permanent.dbm'),
Expand Down

0 comments on commit 731c311

Please sign in to comment.