start implementing a validation layer, refs #215

This commit is contained in:
Jakob Ketterl
2021-01-24 20:53:51 +01:00
parent 8b52988dcd
commit 40e531c0da
8 changed files with 131 additions and 0 deletions

View File

@ -1,4 +1,5 @@
from abc import ABC, abstractmethod
from owrx.property.validators import Validator
import logging
logger = logging.getLogger(__name__)
@ -23,6 +24,7 @@ class Subscription(object):
class PropertyManager(ABC):
def __init__(self):
self.subscribers = []
self.validators = {}
@abstractmethod
def __getitem__(self, item):
@ -81,6 +83,9 @@ class PropertyManager(ABC):
except Exception as e:
logger.exception(e)
def setValidator(self, name, validator):
self.validators[name] = Validator.of(validator)
class PropertyLayer(PropertyManager):
def __init__(self):