mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 10:16:32 +01:00
Added a give command to the default command set. As part of this also fixed some bugs in how object typeclasses were compared.
This commit is contained in:
parent
949da47917
commit
c615693a2a
8 changed files with 53 additions and 21 deletions
|
|
@ -350,13 +350,10 @@ def to_str(obj, encoding='utf-8', force_string=False):
|
|||
if force_string and not isinstance(obj, basestring):
|
||||
# some sort of other object. Try to
|
||||
# convert it to a string representation.
|
||||
if hasattr(obj, '__str__'):
|
||||
obj = obj.__str__()
|
||||
elif hasattr(obj, '__unicode__'):
|
||||
obj = obj.__unicode__()
|
||||
else:
|
||||
# last resort
|
||||
try:
|
||||
obj = str(obj)
|
||||
except Exception:
|
||||
obj = unicode(obj)
|
||||
|
||||
if isinstance(obj, basestring) and isinstance(obj, unicode):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue