wip
This commit is contained in:
parent
eed52f7620
commit
80913481b9
@ -118,9 +118,9 @@ class ConfigUnit:
|
|||||||
else:
|
else:
|
||||||
v = Validator(schema)
|
v = Validator(schema)
|
||||||
result = v.validate(self._data)
|
result = v.validate(self._data)
|
||||||
# pprint(self._data)
|
# pprint.pprint(self._data)
|
||||||
if not result:
|
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)}')
|
raise DocumentError(f'{self.__class__.__name__}: failed to validate data:\n{pprint.pformat(v.errors)}')
|
||||||
try:
|
try:
|
||||||
self.custom_validator(self._data)
|
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
|
#!/usr/bin/env python3
|
||||||
from home.config import config, LinuxBoardsConfig, ServicesListConfig
|
from home.config import config
|
||||||
from home.mqtt import MqttConfig, MqttNodesConfig
|
from home.mqtt import MqttNodesConfig
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user