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

All Samples(18)  |  Call(9)  |  Derive(0)  |  Import(9)
Load config file contents into a Pyramid settings dict.

This is a helper function for initialising a Pyramid settings dict from
a config file.  It flattens the config file sections into dotted settings
names and updates the given dictionary in place.

You would typically use this when constructing a Pyramid Configurator
object, like so::

    def main(global_config, **settings):(more...)

        def load_into_settings(filename, settings):
    """Load config file contents into a Pyramid settings dict.

    This is a helper function for initialising a Pyramid settings dict from
    a config file.  It flattens the config file sections into dotted settings
    names and updates the given dictionary in place.

    You would typically use this when constructing a Pyramid Configurator
    object, like so::

        def main(global_config, **settings):
            config_file = global_config['__file__']
            load_info_settings(config_file, settings)
            config = Configurator(settings=settings)

    """
    filename = os.path.abspath(
                 os.path.normpath(
                   os.path.expandvars(
                     os.path.expanduser(
                       filename))))

    config = Config(filename)

    # Put values from the config file into the pyramid settings dict.
    for section in config.sections():
        setting_prefix = section.replace(":", ".")
        for name, value in config.get_map(section).iteritems():
            settings[setting_prefix + "." + name] = value

    # Store a reference to the Config object itself for later retrieval.
    settings['config'] = config
    return config
        


src/t/o/tokenserver-HEAD/tokenserver/assignment/sqlnode/migrations/env.py   tokenserver(Download)
 
from tokenserver.util import find_config_file
from mozsvc.config import load_into_settings
 
# this is the Alembic Config object, which provides
ini_file = find_config_file(config.get_main_option("token_ini"))
settings = {}
load_into_settings(ini_file, settings)
 
 

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_load_into_settings(self):
        settings = {}
        load_into_settings(self.file_four, settings)
        self.assertEquals(settings["storage.e"], "f")
        self.assertEquals(settings["storage.g"], "h")

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_load_into_settings(self):
        settings = {}
        load_into_settings(self.file_four, settings)
        self.assertEquals(settings["storage.e"], "f")
        self.assertEquals(settings["storage.g"], "h")

src/t/o/tokenserver-HEAD/tokenserver/tests/test_memorynode.py   tokenserver(Download)
 
from tokenserver.assignment import INodeAssignment
from mozsvc.config import load_into_settings
from tokenserver.tests.support import unittest
 
                                'test_memorynode.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        self.config.add_settings(settings)
        self.config.include("tokenserver")

src/t/o/tokenserver-HEAD/tokenserver/tests/test_backend_sql.py   tokenserver(Download)
import os
 
from pyramid import testing
from pyramid.threadlocal import get_current_registry
from mozsvc.config import load_into_settings
                                'test_sql.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        self.config.add_settings(settings)
 

src/s/t/stokenserver-HEAD/stokenserver/tests/test_fixednode.py   stokenserver(Download)
from stokenserver.metadata import IMetadataDB
 
from mozsvc.config import load_into_settings
from cornice.tests import CatchErrors
 
                                'test_fixednode.ini')
        settings = {}
        load_into_settings(self.ini, settings)
        self.config.add_settings(settings)
        self.config.include("stokenserver")

src/t/o/tokenserver-HEAD/tokenserver/tests/test_service.py   tokenserver(Download)
 
from cornice.tests.support import CatchErrors
from mozsvc.config import load_into_settings
from mozsvc.plugin import load_and_register, load_from_settings
 
    def setUp(self):
        self.config = testing.setUp()
        settings = {}
        load_into_settings(self.get_ini(), settings)
        self.config.add_settings(settings)

src/t/o/tokenserver-HEAD/tokenserver/tests/test_purge_old_records.py   tokenserver(Download)
import pyramid.testing
 
from mozsvc.config import load_into_settings
 
from tokenserver.assignment import INodeAssignment
        self.ini_file = os.path.join(os.path.dirname(__file__), 'test_sql.ini')
        settings = {}
        load_into_settings(self.ini_file, settings)
        self.config.add_settings(settings)
        self.config.include("tokenserver")

src/a/p/appsync-HEAD/appsync/tests/test_server.py   appsync(Download)
from webob.dec import wsgify
from pyramid import testing
from mozsvc.config import load_into_settings
 
import vep
    def setUp(self):
        self.config = testing.setUp()
        # creating a test application
        settings = {}
        load_into_settings(self.ini, settings)