diff options
author | mkaay <mkaay@mkaay.de> | 2011-03-13 21:21:44 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2011-03-13 21:21:44 +0100 |
commit | a2990617833baab37f39d0fe5f877849643e4738 (patch) | |
tree | 2304c8f7380f4a688f471d83378bfec07b1256a2 /module | |
parent | make sure everything is written to disk before merging (diff) | |
download | pyload-a2990617833baab37f39d0fe5f877849643e4738.tar.xz |
captcha fix
Diffstat (limited to 'module')
-rw-r--r-- | module/CaptchaManager.py | 4 | ||||
-rw-r--r-- | module/gui/Collector.py | 10 | ||||
-rw-r--r-- | module/gui/connector.py | 2 | ||||
-rw-r--r-- | module/remote/thriftbackend/Handler.py | 10 |
4 files changed, 17 insertions, 9 deletions
diff --git a/module/CaptchaManager.py b/module/CaptchaManager.py index 7672aa645..7bb98dde9 100644 --- a/module/CaptchaManager.py +++ b/module/CaptchaManager.py @@ -52,7 +52,7 @@ class CaptchaManager(): def getTaskByID(self, tid): self.lock.acquire() for task in self.tasks: - if task.id == str(tid): #task ids are strings + if task.id == tid: self.lock.release() return task self.lock.release() @@ -82,7 +82,7 @@ class CaptchaManager(): class CaptchaTask(): def __init__(self, id, img, type, temp): - self.id = str(id) + self.id = id self.captchaImg = img self.captchaType = type self.captchaFile = temp diff --git a/module/gui/Collector.py b/module/gui/Collector.py index 833942eac..cae429de3 100644 --- a/module/gui/Collector.py +++ b/module/gui/Collector.py @@ -144,7 +144,10 @@ class CollectorModel(QAbstractItemModel): inserts a new element in the model """ if event.type == ElementType.File: - info = self.connector.getFileData(event.id) + try: + info = self.connector.getFileData(event.id) + except FileDoesNotExists: + return for k, package in enumerate(self._data): if package.id == info.package: @@ -167,8 +170,9 @@ class CollectorModel(QAbstractItemModel): update an element in the model """ if event.type == ElementType.File: - info = self.connector.proxy.getFileData(event.id) - if not info: + try: + info = self.connector.proxy.getFileData(event.id) + except FileDoesNotExists: return for p, package in enumerate(self._data): if package.id == info.packageID: diff --git a/module/gui/connector.py b/module/gui/connector.py index 634912f64..707bb6a32 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -154,4 +154,6 @@ class DispatchRPC(QObject): finally: self.mutex.unlock() if lost: + from traceback import print_exc + print_exc() self.dispatcher.emit(SIGNAL("connectionLost")) diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py index d71b4337e..7209c6bd5 100644 --- a/module/remote/thriftbackend/Handler.py +++ b/module/remote/thriftbackend/Handler.py @@ -6,6 +6,8 @@ from thriftgen.pyload.Pyload import Iface from module.PyFile import PyFile from module.utils import freeSpace +from base64 import b64encode + class Handler(Iface): def __init__(self, backend): self.backend = backend @@ -442,10 +444,10 @@ class Handler(Iface): Parameters: - exclusive """ - tid, data, type = self.serverMethods.get_captcha_task(exclusive) - tid = int(tid) - - t = CaptchaTask(tid, data, type) + t = CaptchaTask() + t.tid, t.data, t.type = self.serverMethods.get_captcha_task(exclusive) + t.tid = int(t.tid) + t.data = b64encode(t.data) return t def getCaptchaTaskStatus(self, tid): |