mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Remove __unicode__ magic methods no longer needed
This commit is contained in:
parent
1738006dce
commit
de6b42320f
8 changed files with 10 additions and 29 deletions
|
|
@ -138,7 +138,7 @@ class AccountDB(TypedObject, AbstractUser):
|
|||
def __str__(self):
|
||||
return smart_str("%s(account %s)" % (self.name, self.dbid))
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return "%s(account#%s)" % (self.name, self.dbid)
|
||||
|
||||
#@property
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class HelpEntry(SharedMemoryModel):
|
|||
def __str__(self):
|
||||
return self.key
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return '%s' % self.key
|
||||
|
||||
def access(self, accessing_obj, access_type='read', default=False):
|
||||
|
|
@ -111,7 +111,7 @@ class HelpEntry(SharedMemoryModel):
|
|||
default - what to return if no lock of access_type was found
|
||||
"""
|
||||
return self.locks.check(accessing_obj, access_type=access_type, default=default)
|
||||
|
||||
|
||||
#
|
||||
# Web/Django methods
|
||||
#
|
||||
|
|
@ -190,7 +190,7 @@ class HelpEntry(SharedMemoryModel):
|
|||
try:
|
||||
return reverse('%s-detail' % slugify(self._meta.verbose_name),
|
||||
kwargs={
|
||||
'category': slugify(self.db_help_category),
|
||||
'category': slugify(self.db_help_category),
|
||||
'topic': slugify(self.db_key)})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
|
@ -226,7 +226,7 @@ class HelpEntry(SharedMemoryModel):
|
|||
try:
|
||||
return reverse('%s-update' % slugify(self._meta.verbose_name),
|
||||
kwargs={
|
||||
'category': slugify(self.db_help_category),
|
||||
'category': slugify(self.db_help_category),
|
||||
'topic': slugify(self.db_key)})
|
||||
except:
|
||||
return '#'
|
||||
|
|
@ -259,7 +259,7 @@ class HelpEntry(SharedMemoryModel):
|
|||
try:
|
||||
return reverse('%s-delete' % slugify(self._meta.verbose_name),
|
||||
kwargs={
|
||||
'category': slugify(self.db_help_category),
|
||||
'category': slugify(self.db_help_category),
|
||||
'topic': slugify(self.db_key)})
|
||||
except:
|
||||
return '#'
|
||||
|
|
|
|||
|
|
@ -471,8 +471,7 @@ class ServerSession(Session):
|
|||
address = self.address
|
||||
return "%s%s@%s" % (self.uname, symbol, address)
|
||||
|
||||
def __unicode__(self):
|
||||
"""Unicode representation"""
|
||||
def __repr__(self):
|
||||
return "%s" % str(self)
|
||||
|
||||
# Dummy API hooks for use during non-loggedin operation
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class Attribute(SharedMemoryModel):
|
|||
def __str__(self):
|
||||
return smart_str("%s(%s)" % (self.db_key, self.id))
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return "%s(%s)" % (self.db_key, self.id)
|
||||
|
||||
def access(self, accessing_obj, access_type='read', default=False, **kwargs):
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ class TypedObject(SharedMemoryModel):
|
|||
def __str__(self):
|
||||
return smart_str("%s" % self.db_key)
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return "%s" % self.db_key
|
||||
|
||||
#@property
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class Tag(models.Model):
|
|||
def __lt__(self, other):
|
||||
return str(self) < str(other)
|
||||
|
||||
def __unicode__(self):
|
||||
def __repr__(self):
|
||||
return "<Tag: %s%s>" % (self.db_key, "(category:%s)" % self.db_category if self.db_category else "")
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
|
|
@ -718,16 +718,6 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
|
|||
def __str__(self):
|
||||
return self._raw_string
|
||||
|
||||
def __unicode__(self):
|
||||
"""
|
||||
Unfortunately, this is not called during print() statements
|
||||
due to a bug in the Python interpreter. You can always do
|
||||
unicode() or str() around the resulting ANSIString and print
|
||||
that.
|
||||
|
||||
"""
|
||||
return self._raw_string
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
Let's make the repr the command that would actually be used to
|
||||
|
|
|
|||
|
|
@ -852,11 +852,6 @@ class EvCell(object):
|
|||
def __str__(self):
|
||||
"returns cell contents on string form"
|
||||
self.formatted = self._reformat()
|
||||
return str(str(ANSIString("\n").join(self.formatted)))
|
||||
|
||||
def __unicode__(self):
|
||||
"returns cell contents"
|
||||
self.formatted = self._reformat()
|
||||
return str(ANSIString("\n").join(self.formatted))
|
||||
|
||||
|
||||
|
|
@ -1635,9 +1630,6 @@ class EvTable(object):
|
|||
# h = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
||||
return str(str(ANSIString("\n").join([line for line in self._generate_lines()])))
|
||||
|
||||
def __unicode__(self):
|
||||
return str(ANSIString("\n").join([line for line in self._generate_lines()]))
|
||||
|
||||
|
||||
def _test():
|
||||
"""Test"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue