Remove __unicode__ magic methods no longer needed

This commit is contained in:
Griatch 2019-01-30 23:50:43 +01:00
parent c3df77b678
commit 7a535b35fa
8 changed files with 10 additions and 29 deletions

View file

@ -138,7 +138,7 @@ class AccountDB(TypedObject, AbstractUser):
def __str__(self): def __str__(self):
return smart_str("%s(account %s)" % (self.name, self.dbid)) return smart_str("%s(account %s)" % (self.name, self.dbid))
def __unicode__(self): def __repr__(self):
return "%s(account#%s)" % (self.name, self.dbid) return "%s(account#%s)" % (self.name, self.dbid)
#@property #@property

View file

@ -100,7 +100,7 @@ class HelpEntry(SharedMemoryModel):
def __str__(self): def __str__(self):
return self.key return self.key
def __unicode__(self): def __repr__(self):
return '%s' % self.key return '%s' % self.key
def access(self, accessing_obj, access_type='read', default=False): def access(self, accessing_obj, access_type='read', default=False):

View file

@ -471,8 +471,7 @@ class ServerSession(Session):
address = self.address address = self.address
return "%s%s@%s" % (self.uname, symbol, address) return "%s%s@%s" % (self.uname, symbol, address)
def __unicode__(self): def __repr__(self):
"""Unicode representation"""
return "%s" % str(self) return "%s" % str(self)
# Dummy API hooks for use during non-loggedin operation # Dummy API hooks for use during non-loggedin operation

View file

@ -167,7 +167,7 @@ class Attribute(SharedMemoryModel):
def __str__(self): def __str__(self):
return smart_str("%s(%s)" % (self.db_key, self.id)) return smart_str("%s(%s)" % (self.db_key, self.id))
def __unicode__(self): def __repr__(self):
return "%s(%s)" % (self.db_key, self.id) return "%s(%s)" % (self.db_key, self.id)
def access(self, accessing_obj, access_type='read', default=False, **kwargs): def access(self, accessing_obj, access_type='read', default=False, **kwargs):

View file

@ -342,7 +342,7 @@ class TypedObject(SharedMemoryModel):
def __str__(self): def __str__(self):
return smart_str("%s" % self.db_key) return smart_str("%s" % self.db_key)
def __unicode__(self): def __repr__(self):
return "%s" % self.db_key return "%s" % self.db_key
#@property #@property

View file

@ -69,7 +69,7 @@ class Tag(models.Model):
def __lt__(self, other): def __lt__(self, other):
return str(self) < str(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 "") return "<Tag: %s%s>" % (self.db_key, "(category:%s)" % self.db_category if self.db_category else "")
def __str__(self): def __str__(self):

View file

@ -718,16 +718,6 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
def __str__(self): def __str__(self):
return self._raw_string 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): def __repr__(self):
""" """
Let's make the repr the command that would actually be used to Let's make the repr the command that would actually be used to

View file

@ -852,11 +852,6 @@ class EvCell(object):
def __str__(self): def __str__(self):
"returns cell contents on string form" "returns cell contents on string form"
self.formatted = self._reformat() 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)) return str(ANSIString("\n").join(self.formatted))
@ -1635,9 +1630,6 @@ class EvTable(object):
# h = "12345678901234567890123456789012345678901234567890123456789012345678901234567890" # h = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
return str(str(ANSIString("\n").join([line for line in self._generate_lines()]))) 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(): def _test():
"""Test""" """Test"""