Relocate checking_new_account_name menu functions
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 25 Dec 2019 21:45:45 +0000 (21:45 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Mon, 30 Dec 2019 02:17:10 +0000 (02:17 +0000)
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
share/menu.yaml

index 1bdccb0..e67dd04 100644 (file)
@@ -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()
index fd8199c..5e8b344 100644 (file)
@@ -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