コード例 #1
0
 def setUp(self):
     config = {
         'pylons.paths': {
             'controllers': None
         },
         'debug': True,
     }
     self.map = make_map(config)
コード例 #2
0
ファイル: conftest.py プロジェクト: wangrandk/zookeepr
def map():
    config = {
        'pylons.paths': {
            'controllers': None
        },
        'debug': True,
    }
    yield make_map(config)
コード例 #3
0
    def setUp(self):
        # Set up a local state because we aren't sure what has been shoveled into the shared one
        class Obby(object): pass
        myobj = Obby()
        class Callable(object):
            def __call__(self):
                return myobj
        
        request_config().request_local = Callable() 

        config = {
            'pylons.paths' : { 'controllers' : None },
            'debug' : True,
        }
        self.map = make_map(config)
コード例 #4
0
ファイル: environment.py プロジェクト: wangrandk/zookeepr
def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """

    # Setup the SQLAlchemy database engine manually (rather than 'from config')
    # so that we can pull the theme out before we set up the pylons app
    engine = sqlalchemy.create_engine(app_conf['sqlalchemy.url'])
    init_model(engine)

    file_paths = initialise_file_paths()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(
        root=root,
        controllers=os.path.join(root, 'controllers'),
        static_files=[file_paths['theme_public'], file_paths['base_public']],
        templates=[file_paths['base_templates']
                   ],  # apparently pylons still wants this and as a list
        base_templates=file_paths['base_templates'],
        theme_templates=file_paths['theme_templates'])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='zkpylons', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)

    config['pylons.h'] = zkpylons.lib.helpers
    config['pylons.strict_tmpl_context'] = False

    config['pylons.package'] = 'zkpylons'

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=[paths['theme_templates'], paths['base_templates']],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8',
        default_filters=['escape'],
        imports=['from webhelpers.html import escape'])

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    return config
コード例 #5
0
ファイル: environment.py プロジェクト: flosokaks/zookeepr
def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(
        root=root,
        controllers=os.path.join(root, "controllers"),
        static_files=[file_paths["theme_public"], file_paths["base_public"]],
        templates=[file_paths["base_templates"]],  # apparently pylons still wants this and as a list
        base_templates=file_paths["base_templates"],
        theme_templates=file_paths["theme_templates"],
    )

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package="zkpylons", paths=paths)

    config["routes.map"] = make_map(config)
    config["pylons.app_globals"] = app_globals.Globals(config)

    config["pylons.h"] = zkpylons.lib.helpers
    config["pylons.strict_tmpl_context"] = False

    config["pylons.package"] = "zkpylons"

    # Create the Mako TemplateLookup, with the default auto-escaping
    config["pylons.app_globals"].mako_lookup = TemplateLookup(
        directories=[paths["theme_templates"], paths["base_templates"]],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf["cache_dir"], "templates"),
        input_encoding="utf-8",
        default_filters=["escape"],
        imports=["from webhelpers.html import escape"],
    )

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, "sqlalchemy.")
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)

    return config
コード例 #6
0
def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """

    # Setup the SQLAlchemy database engine manually (rather than 'from config')
    # so that we can pull the theme out before we set up the pylons app
    engine = sqlalchemy.create_engine(app_conf['sqlalchemy.url'])
    init_model(engine)

    file_paths = initialise_file_paths()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=[file_paths['theme_public'], file_paths['base_public']],
                 templates=[file_paths['base_templates']],           # apparently pylons still wants this and as a list
                 base_templates=file_paths['base_templates'],
                 theme_templates=file_paths['theme_templates'])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='zkpylons', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)
    
    config['pylons.h'] = zkpylons.lib.helpers
    config['pylons.strict_tmpl_context'] = False

    config['pylons.package'] = 'zkpylons'

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=[paths['theme_templates'], paths['base_templates']],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from webhelpers.html import escape'])

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
    return config
コード例 #7
0
    def setUp(self):
        # Set up a local state because we aren't sure what has been shoveled into the shared one
        class Obby(object):
            pass

        myobj = Obby()

        class Callable(object):
            def __call__(self):
                return myobj

        request_config().request_local = Callable()

        config = {
            'pylons.paths': {
                'controllers': None
            },
            'debug': True,
        }
        self.map = make_map(config)
コード例 #8
0
ファイル: conftest.py プロジェクト: silpol/zookeepr
def map():
    config = {"pylons.paths": {"controllers": None}, "debug": True}
    yield make_map(config)
コード例 #9
0
ファイル: test_routing.py プロジェクト: tmfox/zookeepr
 def setUp(self):
     self.map = make_map()
コード例 #10
0
ファイル: test_routing.py プロジェクト: dtbell91/zookeepr
 def setUp(self):
     config = {
         'pylons.paths' : { 'controllers' : None },
         'debug' : True,
     }
     self.map = make_map(config)
コード例 #11
0
ファイル: test_routing.py プロジェクト: gracz120/zookeepr
 def setUp(self):
     self.map = make_map()