From: Jeremy Stanley Date: Wed, 25 Dec 2019 13:12:43 +0000 (+0000) Subject: Rename state variable in get_menu_choices() X-Git-Tag: 0.1.0~17 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;ds=inline;h=5c4f77cf2f28dedbb24280005ea7db9421ed197f;p=mudpy.git Rename state variable in get_menu_choices() Avoid shadowing the new menu module in misc.get_menu_choices() by renaming its menu variable to state, which is also more consistent with other menu-related functions. --- diff --git a/mudpy/misc.py b/mudpy/misc.py index 24443dd..62f531e 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -1581,8 +1581,8 @@ def get_menu_prompt(state): def get_menu_choices(user): """Return a dict of choice:meaning.""" - menu = universe.groups["menu"][user.state] - create_choices = menu.get("create") + state = universe.groups["menu"][user.state] + create_choices = state.get("create") if create_choices: choices = eval(create_choices) else: @@ -1590,7 +1590,7 @@ def get_menu_choices(user): ignores = [] options = {} creates = {} - for facet in menu.facets(): + for facet in state.facets(): if facet.startswith("demand_") and not eval( universe.groups["menu"][user.state].get(facet) ): @@ -1601,10 +1601,10 @@ def get_menu_choices(user): options[facet] = facet.split("_", 2)[1] for facet in creates.keys(): if not creates[facet] in ignores: - choices[creates[facet]] = eval(menu.get(facet)) + choices[creates[facet]] = eval(state.get(facet)) for facet in options.keys(): if not options[facet] in ignores: - choices[options[facet]] = menu.get(facet) + choices[options[facet]] = state.get(facet) return choices