[hamster-applet] as we now have just one instance of db reader there is no more need for lazy wakeups. establishing c



commit a0cf6b752c677b47433f9184b6c7d4550e3800c8
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue Jun 22 10:54:53 2010 +0100

    as we now have just one instance of db reader there is no more need for lazy wakeups. establishing connection in constructor (fixes bug where service had to be queried before the file monitor would have been started)

 src/hamster/db.py |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/src/hamster/db.py b/src/hamster/db.py
index 3d68749..5991d61 100644
--- a/src/hamster/db.py
+++ b/src/hamster/db.py
@@ -44,12 +44,11 @@ import itertools
 
 class Storage(storage.Storage):
     con = None # Connection will be created on demand
-    def __setup(self):
+    def __init__(self, loop):
         """
         Delayed setup so we don't do everything at the same time
         """
-        if self.__setup.im_func.complete:
-            return
+        storage.Storage.__init__(self, loop)
 
         self.__con = None
         self.__cur = None
@@ -90,14 +89,10 @@ class Storage(storage.Storage):
         self.__db_monitor = self.__database_file.monitor_file()
         self.__db_monitor.connect("changed", on_db_file_change)
 
-
-        self.__setup.im_func.complete = True
         self.run_fixtures()
 
 
 
-    __setup.complete = False
-
     def register_modification(self):
         # db.execute calls this so we know that we were the ones
         # that modified the DB and no extra refesh is not needed
@@ -848,8 +843,6 @@ class Storage(storage.Storage):
     connection = property(get_connection, None)
 
     def fetchall(self, query, params = None):
-        self.__setup()
-
         con = self.connection
         cur = con.cursor()
 
@@ -877,8 +870,6 @@ class Storage(storage.Storage):
         execute sql statement. optionally you can give multiple statements
         to save on cursor creation and closure
         """
-        self.__setup()
-
         con = self.__con or self.connection
         cur = self.__cur or con.cursor()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]