Output request parameters with appropriate separator based on the separator
(conditional_sub_array, condition)
| 72 | |
| 73 | |
| 74 | def output_conditional_params(conditional_sub_array, condition): |
| 75 | """Output request parameters with appropriate separator based on the separator""" |
| 76 | # If the request has 'oneOfMany', then print them in one param section with OR (|) sign. |
| 77 | # 'oneOfMany' example `plugin`: [*plugin|directory*] |
| 78 | # If the request has 'pairedWith', then print them in one param section separated with space. |
| 79 | # 'pairedWith' example `delpay`: [*partid* *groupid*] |
| 80 | # If the request has 'dependentUpon', then print them in one param section separated with space. |
| 81 | # 'dependentUpon' example `listforwards`: [*index* [*start*] [*limit*]] |
| 82 | separator = {'oneOfMany': '|', 'pairedWith': '* *', 'dependentUpon': '*] [*'}.get(condition, '') |
| 83 | # Join all keys with the separator |
| 84 | keysfoundstr = format(esc_underscores(separator.join(conditional_sub_array))) |
| 85 | # Print the merged keys |
| 86 | output('{}'.format(fmt_paramname(keysfoundstr, True, condition != 'dependentUpon'))) |
| 87 | |
| 88 | |
| 89 | def output_type(properties, is_optional): |
no test coverage detected