| @@ 247-266 (lines=20) @@ | ||
| 244 | ||
| 245 | return values.values(), {} |
|
| 246 | ||
| 247 | def _get_spec_value(self, form, uid, key, default=''): |
|
| 248 | """Returns the value assigned to the passed in key for the analysis |
|
| 249 | service uid from the passed in form. |
|
| 250 | ||
| 251 | If check_floatable is true, will return the passed in default if the |
|
| 252 | obtained value is not floatable |
|
| 253 | :param form: form being submitted |
|
| 254 | :param uid: uid of the Analysis Service the specification relates |
|
| 255 | :param key: id of the specs param to get (e.g. 'min') |
|
| 256 | :param check_floatable: check if the value is floatable |
|
| 257 | :param default: fallback value that will be returned by default |
|
| 258 | :type default: str, None |
|
| 259 | """ |
|
| 260 | if not form or not uid: |
|
| 261 | return default |
|
| 262 | values = form.get(key, None) |
|
| 263 | if not values or len(values) == 0: |
|
| 264 | return default |
|
| 265 | value = values[0].get(uid, default) |
|
| 266 | return api.is_floatable(value) and value or default |
|
| 267 | ||
| 268 | security.declarePublic("ReferenceResults") |
|
| 269 | ||
| @@ 353-374 (lines=22) @@ | ||
| 350 | ||
| 351 | return values, {} |
|
| 352 | ||
| 353 | def _get_spec_value(self, form, uid, key, check_floatable=True, |
|
| 354 | default=''): |
|
| 355 | """Returns the value assigned to the passed in key for the analysis |
|
| 356 | service uid from the passed in form. |
|
| 357 | ||
| 358 | If check_floatable is true, will return the passed in default if the |
|
| 359 | obtained value is not floatable |
|
| 360 | ||
| 361 | :param form: form being submitted |
|
| 362 | :param uid: uid of the Analysis Service the specification relates |
|
| 363 | :param key: id of the specs param to get (e.g. 'min') |
|
| 364 | :param check_floatable: check if the value is floatable |
|
| 365 | :param default: fallback value that will be returned by default |
|
| 366 | :type default: str, None |
|
| 367 | """ |
|
| 368 | if not form or not uid: |
|
| 369 | return default |
|
| 370 | values = form.get(key, None) |
|
| 371 | if not values or len(values) == 0: |
|
| 372 | return default |
|
| 373 | value = values[0].get(uid, default) |
|
| 374 | if not check_floatable: |
|
| 375 | return value |
|
| 376 | return api.is_floatable(value) and value or default |
|
| 377 | ||