parameter_data_type = "{}Data Type".format(indent)
parameter_default = "{}Default".format(indent)
parameter_value = "{}Value".format(indent)
fields = fields.append(pd.Series({parameter_data_type: self.data_type,
parameter_default: self.default_value,
parameter_value: self.value}))
order = ["ID", "Flow ID", "Flow Name", "Flow URL", "Parameter Name",
parameter_data_type, parameter_default, parameter_value]
fields = list(fields.reindex(order).dropna().iteritems())
longest_field_name_length = max(len(name) for name, value in fields)
field_line_format = "{{:.<{}}}: {{}}".format(longest_field_name_length)
body = "\n".join(field_line_format.format(name, value) for name, value in fields)
return header + body
After Change
// determines the order in which the information will be printed
order = ["ID", "Flow ID", "Flow Name", "Flow URL", "Parameter Name",
parameter_data_type, parameter_default, parameter_value]
fields = [(key, fields[key]) for key in order if key in fields]
longest_field_name_length = max(len(name) for name, value in fields)
field_line_format = "{{:.<{}}}: {{}}".format(longest_field_name_length)
body = "\n".join(field_line_format.format(name, value) for name, value in fields)
return header + body