Structure handlers to allow .get() to return lists

See #1154. In the end I didn't modify the Attributehandler and
TagHandler like this, instead I added the `return_list` argument
for cases when one wants a guaranteed return.
This commit is contained in:
Griatch 2017-08-27 14:56:05 +02:00
parent 05a3d0435d
commit 92df3ce5ae
13 changed files with 86 additions and 1608 deletions

View file

@ -6,7 +6,7 @@ from datetime import datetime, timedelta
from twisted.internet import reactor, task
from evennia.server.models import ServerConfig
from evennia.utils.logger import log_trace, log_err
from evennia.utils.logger import log_err
from evennia.utils.dbserialize import dbserialize, dbunserialize
TASK_HANDLER = None
@ -113,9 +113,9 @@ class TaskHandler(object):
try:
dbserialize(arg)
except (TypeError, AttributeError):
logger.log_err("The positional argument {} cannot be "
"pickled and will not be present in the arguments "
"fed to the callback {}".format(arg, callback))
log_err("The positional argument {} cannot be "
"pickled and will not be present in the arguments "
"fed to the callback {}".format(arg, callback))
else:
safe_args.append(arg)
@ -123,9 +123,9 @@ class TaskHandler(object):
try:
dbserialize(value)
except (TypeError, AttributeError):
logger.log_err("The {} keyword argument {} cannot be "
"pickled and will not be present in the arguments "
"fed to the callback {}".format(key, value, callback))
log_err("The {} keyword argument {} cannot be "
"pickled and will not be present in the arguments "
"fed to the callback {}".format(key, value, callback))
else:
safe_kwargs[key] = value