diff --git a/contrib/menu_login.py b/contrib/menu_login.py index bc5d22fd6f..c4cf354017 100644 --- a/contrib/menu_login.py +++ b/contrib/menu_login.py @@ -297,7 +297,7 @@ class CmdUnloggedinQuit(Command): # The login menu tree, using the commands above -START = MenuNode("START", text=utils.string_from_module(CONNECTION_SCREEN_MODULE), +START = MenuNode("START", text=utils.random_string_from_module(CONNECTION_SCREEN_MODULE), links=["node1a", "node2a", "node3", "END"], linktexts=["Log in with an existing account", "Create a new account", diff --git a/src/utils/utils.py b/src/utils/utils.py index c72274d32e..e0f8e2da4b 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -844,23 +844,23 @@ def string_from_module(module, variable=None, default=None): """ This is a wrapper for variable_from_module that requires return value to be a string to pass. It's primarily used by login screen. + if variable is not set, returns a list of all string variables in + module """ val = variable_from_module(module, variable=variable, default=default) - if isinstance(val, basestring): - return val - elif is_iter(val): - result = [v for v in val if isinstance(v, basestring)] - return result if result else default + if val: + if variable: + return val + else: + result = [v for v in make_iter(val) if isinstance(v, basestring)] + return result if result else default return default def random_string_from_module(module): """ Returns a random global string from a module """ - string = string_from_module(module) - if is_iter(string): - string = random.choice(string) - return string + return random.choice(string_from_module(module)) def init_new_player(player): """