Relocate delete_account menu function
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 25 Dec 2019 22:23:08 +0000 (22:23 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Mon, 30 Dec 2019 02:17:10 +0000 (02:17 +0000)
Move the action logic for the delete_account state from its
corresponding facet to the menu module, hiding it behind a
consistently-named entry point.

mudpy/menu.py
share/menu.yaml

index 75dc542..39a5ad2 100644 (file)
@@ -76,3 +76,8 @@ def choose_name_create_6(user):
 def choose_name_create_7(user):
     """Provide a randomly-generated name as choice 7."""
     return mudpy.misc.random_name()
+
+
+def delete_account_action_y(user):
+    """Permanently delete the account and all avatars, as requested."""
+    return user.destroy()
index 87176eb..b66074e 100644 (file)
@@ -67,7 +67,7 @@ menu.choose_name.description: Your new avatar needs a name. This will be the
     unremarkable name forever.
 menu.choose_name.prompt: "Choose a name for $(tpop):"
 
-menu.delete_account.action_y: user.destroy()
+menu.delete_account.action_y: mudpy.menu.delete_account_action_y(user)
 menu.delete_account.branch_n: main_utility
 menu.delete_account.branch_y: disconnecting
 menu.delete_account.choice_n: no, don't delete my account