AnyBlok / Pyramid framework

anyblok_pyramid.pyramid_config

class anyblok_pyramid.pyramid_config.Configurator(*args, **kwargs)

Bases: pyramid.config.Configurator

Overwrite the Pyramid Configurator

default_setting()

Call all the entry point anyblok_pyramid.settings to update the argument setting

the callable need to have one parametter, it is a dict:

def settings_callable(setting):
    ...

We add the entry point by the setup file:

setup(
    ...,
    entry_points={
        'anyblok_pyramid.settings': [
            settings_callable=path:settings_callable,
            ...
        ],
    },
    ...,
)
include_from_entry_point()

Call all the entry point anyblok_pyramid.includeme to update the pyramid configuration

the callable need to have one parametter(the instance of Configurator class, self):

def config_callable(config):
    config.include(...)

We add the entry point by the setup file:

setup(
    ...,
    entry_points={
        'anyblok_pyramid.includeme': [
            config_callable=path:config_callable,
            ...
        ],
    },
    ...,
)
load_config_bloks()

loop on each blok, keep the order of the blok to load the pyramid config. The blok must declare the meth pyramid_load_config:

def pyramid_load_config(config):
    config.add_route('hello', '/hello/{name}/')
    ...
class anyblok_pyramid.pyramid_config.AnyBlokRequest(request)

Bases: object

Add anyblok properties in the request

request.anyblok
registry

Add the property registry

registry = request.anyblok.registry

Note

The db_name must be defined

class anyblok_pyramid.pyramid_config.InstalledBlokPredicate(blok_name, config)

Bases: object

Predicate installed_blok

pyramid_config.settings

anyblok_pyramid.pyramid_config.pyramid_settings(settings)

Add in settings the default value for pyramid configuration

Parameters:settings – dict of the existing settings

pyramid_config.includeme

anyblok_pyramid.pyramid_config.static_paths(config)

Pyramid includeme, add the static path of the blok

Parameters:config – Pyramid configurator instance

anyblok_pyramid.scripts module

anyblok_pyramid.scripts.anyblok_wsgi(application, configuration_groups, **kwargs)
Parameters:
  • application – name of the application
  • configuration_groups – list configuration groupe to load
  • **kwargs – ArgumentParser named arguments