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