From 3241aeff1158a0c517bcc213f876b6b10ca03f41 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 25 Dec 2019 21:45:45 +0000 Subject: [PATCH] Relocate checking_new_account_name menu functions Move the action logic for the checking_new_account_name state from its respective facets to the menu module, hiding them behind consistently-named entry points. --- mudpy/menu.py | 10 ++++++++++ share/menu.yaml | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mudpy/menu.py b/mudpy/menu.py index 1bdccb0..e67dd04 100644 --- a/mudpy/menu.py +++ b/mudpy/menu.py @@ -19,3 +19,13 @@ def activate_avatar_create(user): """List available avatars as choices for the activate_avatar state.""" return dict( [(str(x + 1), y) for x, y in enumerate(user.list_avatar_names())]) + + +def checking_new_account_name_action_d(user): + """Destroy the new account because the user asked to disconnect.""" + return user.account.destroy() + + +def checking_new_account_name_action_g(user): + """Destroy the new account, the user asked to go back to name entry.""" + return user.account.destroy() diff --git a/share/menu.yaml b/share/menu.yaml index fd8199c..5e8b344 100644 --- a/share/menu.yaml +++ b/share/menu.yaml @@ -19,8 +19,10 @@ menu.activate_avatar.prompt: Whom would you like to awaken? menu.active.prompt: ">" -menu.checking_new_account_name.action_d: user.account.destroy() -menu.checking_new_account_name.action_g: user.account.destroy() +menu.checking_new_account_name.action_d: + mudpy.menu.checking_new_account_name_action_d(user) +menu.checking_new_account_name.action_g: + mudpy.menu.checking_new_account_name_action_g(user) menu.checking_new_account_name.branch_d: disconnecting menu.checking_new_account_name.branch_g: entering_account_name menu.checking_new_account_name.branch_n: entering_new_password -- 2.11.0