From facb379f3b6cdc5423f8400d756822f5f7890e2c Mon Sep 17 00:00:00 2001
From: RaNaN <Mast3rRaNaN@hotmail.de>
Date: Sat, 29 Jun 2013 19:32:06 +0200
Subject: updated test suite

---
 pyload/database/DatabaseBackend.py | 8 ++++++++
 pyload/remote/WSClient.py          | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

(limited to 'pyload')

diff --git a/pyload/database/DatabaseBackend.py b/pyload/database/DatabaseBackend.py
index 99a406d9c..2244a3026 100644
--- a/pyload/database/DatabaseBackend.py
+++ b/pyload/database/DatabaseBackend.py
@@ -32,6 +32,7 @@ except:
 DB = None
 DB_VERSION = 6
 
+
 def set_DB(db):
     global DB
     DB = db
@@ -132,6 +133,7 @@ class DatabaseBackend(Thread):
         self.setDaemon(True)
         self.core = core
         self.manager = None # set later
+        self.error = None
         self.running = Event()
 
         self.jobs = Queue()
@@ -183,6 +185,8 @@ class DatabaseBackend(Thread):
     def run(self):
         try:
             self.init()
+        except Exception, e:
+            self.error = e
         finally:
             self.running.set()
 
@@ -422,9 +426,12 @@ class DatabaseBackend(Thread):
         self.jobs.put(job)
 
     def queue(self, f, *args, **kwargs):
+        # Raise previous error of initialization
+        if self.error: raise self.error
         args = (self, ) + args
         job = DatabaseJob(f, *args, **kwargs)
         self.jobs.put(job)
+
         # only wait when db is running
         if self.running.isSet(): job.wait()
         return job.result
@@ -443,6 +450,7 @@ class DatabaseBackend(Thread):
                 return getattr(sub, attr)
         raise AttributeError(attr)
 
+
 if __name__ == "__main__":
     db = DatabaseBackend()
     db.setup()
diff --git a/pyload/remote/WSClient.py b/pyload/remote/WSClient.py
index 793a6ef28..0e58c6afa 100644
--- a/pyload/remote/WSClient.py
+++ b/pyload/remote/WSClient.py
@@ -15,7 +15,7 @@ class WSClient:
         self.ws =  None
 
     def connect(self):
-        self.ws = create_connection(self.URL)
+        self.ws = create_connection(self.url)
 
     def close(self):
         self.ws.close()
-- 
cgit v1.2.3