Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (23 sloc) 1.04 KB
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, division, print_function
from configman.namespace import Namespace
#==============================================================================
class RequiredConfig(object):
#--------------------------------------------------------------------------
@classmethod
def get_required_config(cls):
result = Namespace()
for a_class in reversed(cls.__mro__):
try:
result.update(a_class.required_config)
except AttributeError:
pass
return result
#--------------------------------------------------------------------------
def config_assert(self, config):
for a_parameter in self.required_config.keys():
assert a_parameter in config, (
'%s missing from config' % a_parameter
)