Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(26)  |  Call(16)  |  Derive(0)  |  Import(10)
Create a pyramid Configurator and populate it with sensible defaults.

This function is a helper to create and pre-populate a Configurator
object using the given paste-deploy settings dicts.  It uses the
mozsvc.config module to flatten the config paste-deploy config file
into the settings dict so that non-mozsvc pyramid apps can read values
from it easily.

        def get_configurator(global_config, **settings):
    """Create a pyramid Configurator and populate it with sensible defaults.

    This function is a helper to create and pre-populate a Configurator
    object using the given paste-deploy settings dicts.  It uses the
    mozsvc.config module to flatten the config paste-deploy config file
    into the settings dict so that non-mozsvc pyramid apps can read values
    from it easily.
    """
    # Populate a SettingsDict with settings from the deployment file.
    settings = SettingsDict(settings)
    config_file = global_config.get('__file__')
    if config_file is not None:
        load_into_settings(config_file, settings)
    # Update with default pyramid settings, and then insert for all to use.
    config = Configurator(settings={})
    settings.setdefaults(config.registry.settings)
    config.registry.settings = settings
    return config
        


src/s/t/stokenserver-HEAD/stokenserver/__init__.py   stokenserver(Download)
import logging
 
from mozsvc.config import get_configurator
from mozsvc.plugin import load_and_register
 
def main(global_config, **settings):
    config = get_configurator(global_config, **settings)
    config.include(includeme)
    return config.make_wsgi_app()
 

src/d/e/demoapp-HEAD/demoapp/__init__.py   demoapp(Download)
from pyramid.config import Configurator
 
from mozsvc.config import get_configurator
 
from demoapp.resources import Root
 
 
def main(global_config, **settings):
    config = get_configurator(global_config, **settings)

src/t/o/tokenserver-HEAD/tokenserver/__init__.py   tokenserver(Download)
from metlog.logging import hook_logger
 
from mozsvc.config import get_configurator
from mozsvc.plugin import load_and_register, load_from_settings
 
def main(global_config, **settings):
    config = get_configurator(global_config, **settings)
    config.include(includeme)
    return config.make_wsgi_app()
 

src/a/p/appsync-HEAD/appsync/__init__.py   appsync(Download)
from pyramid.settings import asbool
 
from mozsvc.config import get_configurator
from mozsvc.plugin import load_and_register
 
def main(global_config, **settings):
    config = get_configurator(global_config, **settings)
 
    # Use autocommit if we're in testing mode.
    mock_browserid = asbool(os.path.expandvars(global_config.get('test', '')))

src/s/y/syncserver-HEAD/syncserver/__init__.py   syncserver(Download)
def get_configurator(global_config, **settings):
    """Load a SyncStorge configurator object from deployment settings."""
    config = mozsvc.config.get_configurator(global_config, **settings)
    config.begin()
    try:

src/s/e/server-syncstorage-HEAD/syncstorage/__init__.py   server-syncstorage(Download)
def get_configurator(global_config, **settings):
    """Load a SyncStorge configurator object from deployment settings."""
    config = mozsvc.config.get_configurator(global_config, **settings)
    # Ensure that we have metlog loaded and ready for use as early as possible.
    mozsvc.metrics.load_metlog_client(config)

src/m/o/mozsvc-0.7/mozsvc/tests/test_config.py   mozsvc(Download)
 
from mozsvc.exceptions import EnvironmentNotFoundError
from mozsvc.config import (Config, SettingsDict, load_into_settings,
                           get_configurator)
 
    def test_get_configurator(self):
        global_config = {"__file__": self.file_four}
        settings = {"pyramid.testing": "test"}
        config = get_configurator(global_config, **settings)
        settings = config.get_settings()
    def test_get_configurator_nofile(self):
        global_config = {"blah": "blech"}
        settings = {"pyramid.testing": "test"}
        config = get_configurator(global_config, **settings)
        settings = config.get_settings()

src/m/o/mozservices-HEAD/mozsvc/tests/test_config.py   mozservices(Download)
from StringIO import StringIO
 
from mozsvc.config import (Config, SettingsDict, load_into_settings,
                           get_configurator)
 
    def test_get_configurator(self):
        global_config = {"__file__": self.file_four}
        settings = {"pyramid.testing": "test"}
        config = get_configurator(global_config, **settings)
        settings = config.get_settings()
    def test_get_configurator_nofile(self):
        global_config = {"blah": "blech"}
        settings = {"pyramid.testing": "test"}
        config = get_configurator(global_config, **settings)
        settings = config.get_settings()

src/m/o/mozsvc-0.7/mozsvc/tests/test_metrics.py   mozsvc(Download)
from StringIO import StringIO
from mozsvc.config import Config, get_configurator
from mozsvc.plugin import load_from_config
from pyramid.config import Configurator
from textwrap import dedent
    def test_loading_from_configurator_with_default_sender(self):
        config = get_configurator({})
        client = load_metlog_client(config)
        self.failUnless(isinstance(client.sender, StdLibLoggingSender))
 
    def test_loading_from_configurator_with_explicit_sender(self):
        config = get_configurator({}, **{

src/m/o/mozservices-HEAD/mozsvc/tests/test_metrics.py   mozservices(Download)
from StringIO import StringIO
from mozsvc.config import Config, get_configurator
from mozsvc.plugin import load_from_config
from pyramid.config import Configurator
from textwrap import dedent
    def test_loading_from_configurator_with_default_sender(self):
        config = get_configurator({})
        client = load_metlog_client(config)
        self.failUnless(isinstance(client.sender, StdLibLoggingSender))
 
    def test_loading_from_configurator_with_explicit_sender(self):
        config = get_configurator({}, **{

  1 | 2  Next