- python DB code: add clear cache method, and fix equality crash

(from Jeremy Cowles)

svn path=/trunk/boinc/; revision=18258
This commit is contained in:
David Anderson 2009-06-02 04:07:53 +00:00
parent f47ae35b4d
commit cb0c57c590
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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):