def includeme(config): """ Setup the dealer. """ settings = dict(DEFAULTS) settings.update(dict( (key.split('.', 1)[1], value) for key, value in config.registry.settings.items() if key.startswith('dealer.') )) config.registry.settings['dealer'] = settings config.registry.dealer = get_backend( settings['type'], path=settings['path'], filename=settings['filename'], backends=settings['backends'], silent=settings['silent'], ) if settings['context']: config.add_subscriber(dealer_context, 'pyramid.events.BeforeRender')
def includeme(config): """ Setup the dealer. """ settings = dict(DEFAULTS) settings.update( dict((key.split('.', 1)[1], value) for key, value in config.registry.settings.items() if key.startswith('dealer.'))) config.registry.settings['dealer'] = settings config.registry.dealer = get_backend( settings['type'], path=settings['path'], filename=settings['filename'], backends=settings['backends'], silent=settings['silent'], ) if settings['context']: config.add_subscriber(dealer_context, 'pyramid.events.BeforeRender')
def test_backends(self): from dealer import get_backend path = op.dirname(__file__) auto = get_backend('auto', path=path, backends=('simple', 'git')) self.assertTrue(auto.repo)
def test_common(self): from dealer import get_backend git = get_backend('git') self.assertTrue(git.repo)
from django.conf import settings from dealer import get_backend TYPE = getattr(settings, 'DEALER_TYPE', 'auto') PATH = getattr(settings, 'DEALER_PATH', None) FILENAME = getattr(settings, 'DEALER_FILENAME', None) BACKENDS = getattr(settings, 'DEALER_BACKENDS', None) BACKEND = get_backend(TYPE, path=PATH, filename=FILENAME, backends=BACKENDS)
def test_common(): from dealer import get_backend git = get_backend('git') assert git.repo