Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Problem with options whose default is a type dict #137

Open
peterbe opened this issue Jan 12, 2015 · 1 comment
Open

Problem with options whose default is a type dict #137

peterbe opened this issue Jan 12, 2015 · 1 comment

Comments

@peterbe
Copy link
Contributor

peterbe commented Jan 12, 2015

Here's the traceback

Traceback (most recent call last):
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 93, in inner_run
    self.validate(display_num_errors=True)
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/db/models/loading.py", line 166, in get_app_errors
    self._populate()
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/db/models/loading.py", line 72, in _populate
    self.load_app(app_name, True)
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/db/models/loading.py", line 96, in load_app
    models = import_module('.models', app_name)
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/peterbe/dev/MOZILLA/SOCORRO/socorro/webapp-django/crashstats/dataservice/models.py", line 38, in <module>
    environment
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/configman/__init__.py", line 76, in configuration
    cm = ConfigurationManager(*args, **kwargs)
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/configman/config_manager.py", line 237, in __init__
    known_keys = self._overlay_expand()
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/configman/config_manager.py", line 643, in _overlay_expand
    new_req = an_option.value.get_required_config()
  File "/Users/peterbe/virtualenvs/socorro/lib/python2.6/site-packages/configman/dotdict.py", line 167, in __getattr__
    raise KeyError(key)
KeyError: 'get_required_config'

This happened when I was tinkering with @selenamarie 's PR because I was putting this config in:

DATASERVICE_CONFIG_BASE = base.DATASERVICE_CONFIG_BASE
DATASERVICE_CONFIG_BASE['services'] = {
        'Bugs': {
            'transaction_executor_class':
                'socorro.database.transaction_executor.TransactionExecutor',#WithLimitedBackoff',
            'backoff_delays': "0",
            'database_password': '',
            'database_username': 'peterbe',
            'database_name': 'socorro_integration_test',
            'api_whitelist': {
                'hits': ['signature']
            }
        }
    }

The solution was to do this:

DATASERVICE_CONFIG_BASE = base.DATASERVICE_CONFIG_BASE
import json
DATASERVICE_CONFIG_BASE['services'] = {
        'Bugs': {
            'transaction_executor_class':
                'socorro.database.transaction_executor.TransactionExecutor',#WithLimitedBackoff',
            'backoff_delays': "0",
            'database_password': '',
            'database_username': 'peterbe',
            'database_name': 'socorro_integration_test',
            'api_whitelist': json.dumps({  # NOTE!
                'hits': ['signature']
            })
        }
    }

The problem is that the _overlay_expand() goes into the default as if it could be a possible nested thing.

@twobraids
Copy link
Contributor

interestingly, I encountered this problem over the weekend, too. I've got a patch for it.

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

No branches or pull requests

2 participants