Skip to content

Assign kwargs key, value to brubeck #99

@kracekumar

Description

@kracekumar

Brubeck() takes **kwargs but key, value isn't stored in brubeck object, storing the key, value is useful for third party libraries.

Example:

config = {
    'msg_conn': WSGIConnection(),
    'template_loader': load_jinja2_env('./../demos/templates'),
    'cookie_secret': 'OMGSOOOOOSECRET',
    'assets': {
        'directory': './../assets',
        'debug': True,
        }
}


# Instantiate app instance
b_app = Brubeck(**config)
app = SimpleURL(b_app)
from brubeck_utils.assets import Environment
assets = Environment(app)

right now I need to access brubeck configuration values as well, one way to get around this is.
assets = Environment(app, config['assests']) or assets = Environment(config).

Currently brubeck doesn't have config object which can used by third party modules.

There are two ways to fix:

  1. Add config dict which stores all configuration details passed during object creation, so that third party libraries can access it. EG: I can place my CAPTCHA_SECRET, OAUTH_SECRET in config dict or python file.
  2. Assign kwargs key, value during object creation.
for key, value in kwargs.items():
      setattr(self, key, value)

Method 1 is preferred.

I will be happy to submit the patch, if accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions