Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign kwargs key, value to brubeck #99

Open
kracekumar opened this issue Dec 13, 2012 · 0 comments
Open

Assign kwargs key, value to brubeck #99

kracekumar opened this issue Dec 13, 2012 · 0 comments

Comments

@kracekumar
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant