wip
This commit is contained in:
parent
eed52f7620
commit
80913481b9
@ -118,9 +118,9 @@ class ConfigUnit:
|
||||
else:
|
||||
v = Validator(schema)
|
||||
result = v.validate(self._data)
|
||||
# pprint(self._data)
|
||||
# pprint.pprint(self._data)
|
||||
if not result:
|
||||
# pprint(v.errors)
|
||||
# pprint.pprint(v.errors)
|
||||
raise DocumentError(f'{self.__class__.__name__}: failed to validate data:\n{pprint.pformat(v.errors)}')
|
||||
try:
|
||||
self.custom_validator(self._data)
|
||||
|
@ -1 +0,0 @@
|
||||
from ._util import validate
|
@ -1,11 +0,0 @@
|
||||
import inspect
|
||||
|
||||
from cerberus import Validator, DocumentError
|
||||
|
||||
|
||||
def validate(schema, data):
|
||||
v = Validator(schema)
|
||||
if not v.validate(data):
|
||||
frame = inspect.currentframe().f_back
|
||||
caller_name = frame.f_code.co_name
|
||||
raise DocumentError(f'{caller_name}: failed to validate data: ' + v.errors)
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
from home.config import config, LinuxBoardsConfig, ServicesListConfig
|
||||
from home.mqtt import MqttConfig, MqttNodesConfig
|
||||
from home.config import config
|
||||
from home.mqtt import MqttNodesConfig
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user