From: Jeremy Stanley Date: Sat, 16 Apr 2016 01:02:48 +0000 (+0000) Subject: Fix show element command for Py3K X-Git-Tag: 0.0.1~191 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=adc38982a3d0a1720febe55f1ee9a713f02c6fc2;p=mudpy.git 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. --- 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":