X-Git-Url: http://git.treefish.org/~alex/photosort.git/blobdiff_plain/0c3d67ff5da26de2b8b531caaaf4b65ec8dc135c..refs/heads/master:/src/registry.py diff --git a/src/registry.py b/src/registry.py index 3d8cfd3..a2bad86 100644 --- a/src/registry.py +++ b/src/registry.py @@ -15,27 +15,27 @@ class Registry: self._conn = sqlite3.connect(db_file, check_same_thread=False) def is_registered(self, name): - if not db_file: return False + if not self._conn: return False c = self._conn.cursor() c.execute("SELECT COUNT(*) FROM cache WHERE name=?", (name,)) - return c.fetchone() != None + return c.fetchone()[0] == 1 def clean(self): - if not db_file: return + if not self._conn: return c = self._conn.cursor() c.execute("DELETE FROM cache WHERE access_time