From 1c2dcc999a7ce8593630931f5a40fe5a317daff6 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 8 Jul 2012 14:53:21 -0400 Subject: [PATCH] __repr__ and __str__ for ExclusionsDB (#5). --- earwigbot/wiki/copyvios/exclusions.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/earwigbot/wiki/copyvios/exclusions.py b/earwigbot/wiki/copyvios/exclusions.py index fdbaa39..7eb6a80 100644 --- a/earwigbot/wiki/copyvios/exclusions.py +++ b/earwigbot/wiki/copyvios/exclusions.py @@ -52,6 +52,15 @@ class ExclusionsDB(object): self._logger = logger self._db_access_lock = Lock() + def __repr__(self): + """Return the canonical string representation of the ExclusionsDB.""" + res = "ExclusionsDB(sitesdb={0!r}, dbfile={1!r}, logger={2!r})" + return res.format(self._sitesdb, self._dbfile, self._logger) + + def __str__(self): + """Return a nice string representation of the ExclusionsDB.""" + return "".format(self._dbfile) + def _create(self): """Initialize the exclusions database with its necessary tables.""" script = """