diff --git a/edbob/core.py b/edbob/core.py index 04a00ea..1d9f44e 100644 --- a/edbob/core.py +++ b/edbob/core.py @@ -57,6 +57,16 @@ class Object(object): if hasattr(self, key): return getattr(self, key) + def __str__(self): + """ + Leverage :meth:`__unicode__()` method if it exists; otherwise fall back + to ``repr(self)``. + """ + + if hasattr(self, '__unicode__'): + return str(unicode(self)) + return repr(self) + def basic_logging(): """