Under Python 3, the dict.keys() method returns a generator rather
than a list and so cannot support the list.sort() method. Instead
use the sorted() function for this purpose in the show element
command. Also switch from concatenation to formatting to embed
facets in the output since they may contain nontext values.
+ "\" element (in \"" + element.origin.filename
+ "\"):$(eol)")
facets = element.facets()
- facets.sort()
- for facet in facets:
- message += ("$(eol) $(grn)" + facet + ": $(red)"
- + escape_macros(element.get(facet)) + "$(nrm)")
+ for facet in sorted(facets):
+ message += ("$(eol) $(grn)%s: $(red)%s$(nrm)" %
+ (facet, escape_macros(element.get(facet))))
else:
message = "Element \"" + arguments[1] + "\" does not exist."
elif arguments[0] == "result":