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