Skip to content

Commit

Permalink
Issue #46 : Fix unicode() in Model.__str__() for breaking change betw…
Browse files Browse the repository at this point in the history
…een py2 and py3.
  • Loading branch information
nobrin committed Jan 16, 2021
1 parent 13349f1 commit 03d3cd0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion macaron.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,9 @@ def __repr__(self):
return "<%s object %s>" % (self.__class__.__name__, self.pk)

def __unicode__(self): return u"<%s object %s>" % (self.__class__.__name__, self.pk)
def __str__(self): return unicode(self).encode("utf-8")
def __str__(self):
if PY3K: return "<%s object %s>" % (self.__class__.__name__, self.pk)
return unicode(self).encode("utf-8")

# --- Aggregation functions
class AggregateFunction(object):
Expand Down

0 comments on commit 03d3cd0

Please sign in to comment.