Configuration data get stored in string format, convert it in to required format. :param res: type value.
(self, res)
| 136 | return self.default |
| 137 | |
| 138 | def _get_format_data(self, res): |
| 139 | """ |
| 140 | Configuration data get stored in string format, convert it in to |
| 141 | required format. |
| 142 | :param res: type value. |
| 143 | """ |
| 144 | if self._type in ('boolean', 'switch', 'node'): |
| 145 | return True, res.value == 'True' |
| 146 | if self._type == 'options': |
| 147 | for opt in self.options: |
| 148 | if 'value' in opt and opt['value'] == res.value: |
| 149 | return True, res.value |
| 150 | |
| 151 | if self.control_props and 'creatable' in self.control_props and \ |
| 152 | self.control_props['creatable']: |
| 153 | return True, res.value |
| 154 | |
| 155 | if self.select and 'tags' in self.select and self.select['tags']: |
| 156 | return True, res.value |
| 157 | return True, self.default |
| 158 | if self._type == 'select': |
| 159 | if res.value: |
| 160 | res.value = res.value.replace('[', '') |
| 161 | res.value = res.value.replace(']', '') |
| 162 | res.value = res.value.replace('\'', '') |
| 163 | return True, [val.strip() for val in res.value.split(',')] |
| 164 | return True, None |
| 165 | |
| 166 | return False, None |
| 167 | |
| 168 | def set(self, value, user_id=None): |
| 169 | """ |