Example #1
0
 def validate(cls, config, non_hidden=False):
     if non_hidden and cls.__ctx_hidden__:
         raise exceptions.NoSuchContext(name=cls.__ctx_name__)
     jsonschema.validate(config, cls.CONFIG_SCHEMA)
Example #2
0
 def get_by_name(name):
     """Return Context class by name."""
     for context in utils.itersubclasses(Context):
         if name == context.__ctx_name__:
             return context
     raise exceptions.NoSuchContext(name=name)
Example #3
0
 def validate(cls, config, non_hidden=False):
     if non_hidden and cls._meta_get("hidden"):
         raise exceptions.NoSuchContext(name=cls.get_name())
     jsonschema.validate(config, cls.CONFIG_SCHEMA)