Browse Source

Added new properties and the check_options method to the DataHandler class

Roland Haroutiounian 8 years ago
parent
commit
c2f62bce50
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      lodel/leapi/datahandlers/base_classes.py

+ 12
- 0
lodel/leapi/datahandlers/base_classes.py View File

@@ -30,6 +30,9 @@ class DataHandler(object):
30 30
     __custom_handlers = dict()
31 31
 
32 32
     help_text = 'Generic Field Data Handler'
33
+    display_name = "Generic Field"
34
+    options_spec = dict()
35
+    options_values = dict()
33 36
 
34 37
     ##@brief List fields that will be exposed to the construct_data_method
35 38
     _construct_datas_deps = []
@@ -57,6 +60,15 @@ class DataHandler(object):
57 60
             del(kwargs['default'])
58 61
         for argname, argval in kwargs.items():
59 62
             setattr(self, argname, argval)
63
+        self.check_options()
64
+
65
+    def check_options(self):
66
+        for option_name, option_value in self.options_values.items():
67
+            self.options_values[option_name] = self.options_spec[option_name].check_value(option_value)
68
+
69
+    @property
70
+    def options(self):
71
+        return self.options_values
60 72
 
61 73
     ## Fieldtype name
62 74
     @classmethod

Loading…
Cancel
Save