Updates to menu_node to make sure separate, new cmdsets are initialized in different tree instances, as per #596.

This commit is contained in:
Griatch 2014-10-17 19:32:33 +02:00
parent 8a9e1a9b4b
commit 182488a713
2 changed files with 6 additions and 4 deletions

View file

@ -346,7 +346,7 @@ node3 = MenuNode("node3", text=LOGIN_SCREEN_HELP,
class UnloggedInCmdSet(CmdSet):
"Cmdset for the unloggedin state"
key = "UnloggedinState"
key = "DefaultUnloggedin"
priority = 0
def at_cmdset_creation(self):
@ -361,6 +361,7 @@ class CmdUnloggedinLook(Command):
to the menu's own look command..
"""
key = CMD_LOGINSTART
aliases = ["look", "l"]
locks = "cmd:all()"
def func(self):

View file

@ -150,7 +150,7 @@ class MenuTree(object):
tree as needed. For safety, being in a menu will not survive a
server reboot.
A menutree have two special node keys given by 'startnode' and
A menutree has two special node keys given by 'startnode' and
'endnode' arguments. The startnode is where the user will start
upon first entering the menu. The endnode need not actually
exist, the moment it is linked to and that link is used, the menu
@ -188,7 +188,6 @@ class MenuTree(object):
Add a menu node object to the tree. Each node itself keeps
track of which nodes it is connected to.
"""
menunode.init(self)
self.tree[menunode.key] = menunode
def goto(self, key):
@ -206,6 +205,8 @@ class MenuTree(object):
# not exiting, look for a valid code.
node = self.tree.get(key, None)
if node:
# initialize - this creates new cmdset
node.init(self)
if node.code:
# Execute eventual code active on this
# node. self.caller is available at this point.
@ -266,7 +267,7 @@ class MenuNode(object):
code block, as well as ev.
nodefaultcmds - if true, don't offer the default help and look commands
in the node
separator - this string will be put on the line between menu nodes5B.
separator - this string will be put on the line between menu nodes.
"""
self.key = key
self.cmdset = None