From 9869ce749413eafc0f20db4610b80f248a422d67 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Wed, 5 Jul 2006 23:02:33 -0800 Subject: [PATCH] add some repr's so the base class won't confuse me when printing.. this makes things a bit clearer, and prevents large output.. [git-p4: depot-paths = "//depot/": change = 821] --- DIDLLite.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DIDLLite.py b/DIDLLite.py index 41f5338..b029f55 100644 --- a/DIDLLite.py +++ b/DIDLLite.py @@ -58,6 +58,12 @@ class Object(object): if kwargs.has_key('content'): self._content = kwargs['content'] + def __repr__(self): + cls = self.__class__ + return '<%s.%s: id: %s, parent: %s, title: %s>' % \ + (cls.__module__, cls.__name__, self.id, self.parentID, + self.title) + def checkUpdate(self): return self @@ -258,6 +264,12 @@ class Container(Object, list): return root + def __repr__(self): + cls = self.__class__ + return '<%s.%s: id: %s, parent: %s, title: %s, cnt: %d>' % \ + (cls.__module__, cls.__name__, self.id, self.parentID, + self.title, len(self)) + class Person(Container): klass = Container.klass + '.person'