From cb0c57c59030a73101d735bebb65d2e8e9d742c5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 2 Jun 2009 04:07:53 +0000 Subject: [PATCH] - python DB code: add clear cache method, and fix equality crash (from Jeremy Cowles) svn path=/trunk/boinc/; revision=18258 --- checkin_notes | 7 +++++++ py/Boinc/db_base.py | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index 6f49e96a31..df7bbf50ee 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4901,3 +4901,10 @@ Charlie 1 June 2009 clientgui/ AsyncRPC.cpp browser.cpp + +David 1 June 2009 + - python DB code: add clear cache method, and fix equality crash + (from Jeremy Cowles) + + py/Boinc/ + boinc_db.py diff --git a/py/Boinc/db_base.py b/py/Boinc/db_base.py index 6e6f11fe3b..a42bddb85e 100644 --- a/py/Boinc/db_base.py +++ b/py/Boinc/db_base.py @@ -246,6 +246,12 @@ class DatabaseTable: and not just "id")''' pass + def clear_cache(self): + """ + Clears the cached objects list + """ + self.object_cache = [] + def count(self, **kwargs): """Return the number of database objects matching keywords. @@ -450,7 +456,7 @@ class DatabaseObject: self.do_init(kwargs) def __eq__(self, other): - return other!=None and self.id == other.id + return other!=None and isinstance(other, DatabaseObject) and self.id == other.id def __ne__(self, other): return not (self == other) def __hash__(self):