start implementing a validation layer, refs #215
This commit is contained in:
@ -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):
|
||||
|
Reference in New Issue
Block a user