MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / _get_format_data

Method _get_format_data

web/pgadmin/utils/preferences.py:138–166  ·  view source on GitHub ↗

Configuration data get stored in string format, convert it in to required format. :param res: type value.

(self, res)

Source from the content-addressed store, hash-verified

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 """

Callers 1

getMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected