From adc38982a3d0a1720febe55f1ee9a713f02c6fc2 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sat, 16 Apr 2016 01:02:48 +0000 Subject: [PATCH] Fix show element command for Py3K 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. --- lib/mudpy/misc.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index ed205a2..f4c8779 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -2172,10 +2172,9 @@ def command_show(actor, parameters): + "\" 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": -- 2.11.0