Fix problem with trying to pass non-text to msg(text=...). Resolves #996.

This commit is contained in:
Griatch 2016-06-15 08:11:00 +02:00
parent 5353b6617d
commit 8fe631d808
3 changed files with 5 additions and 3 deletions

View file

@ -21,7 +21,7 @@ from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.commands import cmdhandler
from evennia.utils import logger
from evennia.utils.utils import (variable_from_module, lazy_property,
make_iter, to_unicode)
make_iter, to_unicode, to_str)
_MULTISESSION_MODE = settings.MULTISESSION_MODE
@ -501,6 +501,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
except Exception:
logger.log_trace()
text = text if text is None else to_str(text, force_string=True)
kwargs["options"] = options
# relay to session(s)

View file

@ -416,6 +416,7 @@ class DefaultPlayer(with_metaclass(TypeclassBase, PlayerDB)):
except Exception:
pass
text = text if text is None else to_str(text, force_string=True)
kwargs["options"] = options
# session relay

View file

@ -16,7 +16,7 @@ from django.utils import timezone
from django.conf import settings
from evennia.comms.models import ChannelDB
from evennia.utils import logger
from evennia.utils.utils import make_iter, lazy_property
from evennia.utils.utils import make_iter, lazy_property, to_str
from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.server.session import Session
@ -392,7 +392,7 @@ class ServerSession(Session):
# that auto-adds the session, we'd get a kwarg collision.
kwargs.pop("session", None)
if text is not None:
self.data_out(text=text, **kwargs)
self.data_out(text=to_str(text, force_string=True), **kwargs)
else:
self.data_out(**kwargs)