Change how eveditor converts non-strings and also giving a warning it was done.
This commit is contained in:
parent
088386dfc8
commit
4bd283609b
1 changed files with 4 additions and 9 deletions
|
|
@ -233,13 +233,7 @@ class CmdEditorBase(Command):
|
||||||
editor = self.caller.ndb._eveditor
|
editor = self.caller.ndb._eveditor
|
||||||
self.editor = editor
|
self.editor = editor
|
||||||
|
|
||||||
try:
|
linebuffer = self.editor.get_buffer().split("\n")
|
||||||
linebuffer = self.editor.get_buffer().split("\n")
|
|
||||||
except AttributeError:
|
|
||||||
# this happens if we tried to edit a non-string.
|
|
||||||
self.editor._buffer = to_str(self.editor._buffer, force_string=True)
|
|
||||||
linebuffer = self.editor.get_buffer().split("\n")
|
|
||||||
|
|
||||||
|
|
||||||
nlines = len(linebuffer)
|
nlines = len(linebuffer)
|
||||||
|
|
||||||
|
|
@ -731,6 +725,9 @@ class EvEditor(object):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self._buffer = self._loadfunc(self._caller)
|
self._buffer = self._loadfunc(self._caller)
|
||||||
|
if not isinstance(self._buffer, basestring):
|
||||||
|
self._buffer = to_str(self._buffer, force_string=True)
|
||||||
|
self._caller.msg("|rNote: input buffer was converted to a string.|n")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
logger.log_trace()
|
logger.log_trace()
|
||||||
|
|
@ -844,8 +841,6 @@ class EvEditor(object):
|
||||||
"""
|
"""
|
||||||
if buf is None:
|
if buf is None:
|
||||||
buf = self._buffer
|
buf = self._buffer
|
||||||
if not isinstance(buf, basestring):
|
|
||||||
buf = to_str(buf, force_string=True)
|
|
||||||
if is_iter(buf):
|
if is_iter(buf):
|
||||||
buf = "\n".join(buf)
|
buf = "\n".join(buf)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue