Add __repr__ to mapped classes
authorPetr Viktorin <encukou@gmail.com>
Sun, 3 Apr 2011 18:00:58 +0000 (21:00 +0300)
committerPetr Viktorin <encukou@gmail.com>
Sun, 3 Apr 2011 18:18:37 +0000 (21:18 +0300)
This makes string representations of lists, tuples, dicts, etc. with the
DB objects make sense

pokedex/db/tables.py

index 5670da9..55cd487 100644 (file)
@@ -62,6 +62,9 @@ class TableSuperclass(object):
     def __str__(self):
         return unicode(self).encode('utf8')
 
+    def __repr__(self):
+        return unicode(self).encode('utf8')
+
 mapped_classes = []
 class TableMetaclass(DeclarativeMeta):
     def __init__(cls, name, bases, attrs):