Revision f7f03738 lib/cli.py
b/lib/cli.py | ||
---|---|---|
234 | 234 |
"ToStderr", "ToStdout", |
235 | 235 |
"FormatError", |
236 | 236 |
"FormatQueryResult", |
237 |
"FormatParameterDict", |
|
238 | 237 |
"FormatParamsDictInfo", |
239 | 238 |
"FormatPolicyInfo", |
240 | 239 |
"PrintGenericInfo", |
... | ... | |
3592 | 3591 |
return [row[1:3] for row in self.jobs] |
3593 | 3592 |
|
3594 | 3593 |
|
3595 |
def FormatParameterDict(buf, param_dict, actual, level=1): |
|
3596 |
"""Formats a parameter dictionary. |
|
3597 |
|
|
3598 |
@type buf: L{StringIO} |
|
3599 |
@param buf: the buffer into which to write |
|
3600 |
@type param_dict: dict |
|
3601 |
@param param_dict: the own parameters |
|
3602 |
@type actual: dict |
|
3603 |
@param actual: the current parameter set (including defaults) |
|
3604 |
@param level: Level of indent |
|
3605 |
|
|
3606 |
""" |
|
3607 |
indent = " " * level |
|
3608 |
|
|
3609 |
for key in sorted(actual): |
|
3610 |
data = actual[key] |
|
3611 |
buf.write("%s- %s:" % (indent, key)) |
|
3612 |
|
|
3613 |
if isinstance(data, dict) and data: |
|
3614 |
buf.write("\n") |
|
3615 |
FormatParameterDict(buf, param_dict.get(key, {}), data, |
|
3616 |
level=level + 1) |
|
3617 |
else: |
|
3618 |
val = param_dict.get(key, "default (%s)" % data) |
|
3619 |
buf.write(" %s\n" % val) |
|
3620 |
|
|
3621 |
|
|
3622 | 3594 |
def FormatParamsDictInfo(param_dict, actual): |
3623 | 3595 |
"""Formats a parameter dictionary. |
3624 | 3596 |
|
Also available in: Unified diff