hive_sales_sync_costarica/orm/fields/base.py
Marvin Vallecillo a2663d15be First commit
2024-07-17 04:19:28 -06:00

18 lines
476 B
Python

class AttributeGetter:
mandatory = []
# noinspection PyUnusedLocal
def __init__(self, *args, **kwargs):
if not hasattr(self, 'value'):
self.value = None
for m in self.mandatory:
if not hasattr(self, m) or getattr(self, m) is None:
raise ValueError(f'Value attribute must have {m} assigned')
def get_value(self):
return self.value
def get_value_serialized(self):
return self.value