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

Function validate_options

web/pgadmin/browser/server_groups/servers/utils.py:197–235  ·  view source on GitHub ↗

This function will filter validated options and sets flag to use in sql template if there are any valid options Args: options: List of options option_name: Option Name option_value: Option Value Returns: Flag, Filtered options

(options, option_name, option_value)

Source from the content-addressed store, hash-verified

195
196
197def validate_options(options, option_name, option_value):
198 """
199 This function will filter validated options
200 and sets flag to use in sql template if there are any
201 valid options
202
203 Args:
204 options: List of options
205 option_name: Option Name
206 option_value: Option Value
207
208 Returns:
209 Flag, Filtered options
210 """
211 valid_options = []
212 is_valid_options = False
213
214 for option in options:
215 # If option name is valid
216 if option_name in option and \
217 option[option_name] is not None and \
218 option[option_name] != '' and \
219 len(option[option_name].strip()) > 0:
220 # If option value is valid
221 if option_value in option and \
222 option[option_value] is not None and \
223 option[option_value] != '' and \
224 len(option[option_value].strip()) > 0:
225 # Do nothing here
226 pass
227 else:
228 # Set empty string if no value provided
229 option[option_value] = ''
230 valid_options.append(option)
231
232 if len(valid_options) > 0:
233 is_valid_options = True
234
235 return is_valid_options, valid_options
236
237
238def _password_check(server, manager, old_key, new_key):

Callers 9

createMethod · 0.90
_get_create_sqlMethod · 0.90
createMethod · 0.90
get_sqlMethod · 0.90
createMethod · 0.90
get_update_sqlMethod · 0.90
get_sqlMethod · 0.90

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected