Multiple fixes to ev and utils:

Made utils.variable_from_module more generic (it can now load pretty much any form of module it's given and also supports searching and returning multiple variables).

Removed the variable-load functionality from utils.load_module; this is now purely a loader - use variable_from_module instead.

I found out that one couldn't import from src.commands.default due to the __init__ file being restrictive for the sake of the ev API. Removed that and instead imported the default commands into ev.py with the help of utils.variable_from_module instead. Some more fixes in ev followed on this.
This commit is contained in:
Griatch 2012-04-22 12:23:42 +02:00
parent 3306e36d82
commit 4678234e9a
11 changed files with 211 additions and 188 deletions

View file

@ -47,7 +47,7 @@ __all__ = ("cmdhandler",)
# This decides which command parser is to be used.
# You have to restart the server for changes to take effect.
_COMMAND_PARSER = utils.mod_import(*settings.COMMAND_PARSER.rsplit('.', 1))
_COMMAND_PARSER = utils.variable_from_module(*settings.COMMAND_PARSER.rsplit('.', 1))
# System command names - import these variables rather than trying to
# remember the actual string constants. If not defined, Evennia