From 66b84a69745e41e8543ffd7ee0abb137a81f2563 Mon Sep 17 00:00:00 2001 From: mkaay Date: Thu, 6 May 2010 17:53:48 +0200 Subject: better request factory --- module/RequestFactory.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'module/RequestFactory.py') diff --git a/module/RequestFactory.py b/module/RequestFactory.py index a2a3ad902..9b56f4778 100644 --- a/module/RequestFactory.py +++ b/module/RequestFactory.py @@ -29,17 +29,20 @@ class RequestFactory(): def getRequest(self, pluginName, account=None): self.lock.acquire() + cookieFile = None for req in self.requests: if req[0:2] == (pluginName, account): - self.lock.release() - return req[2] - name = pluginName - if account: - name += "_" - name += account - th = NamedTemporaryFile(mode="w", prefix="pyload_cookies_%s" % name, delete=False) - cookieFile = th.name - th.close() + cookieFile = req[2].cookieFile + break + + if not cookieFile: + name = pluginName + if account: + name += "_" + name += account + th = NamedTemporaryFile(mode="w", prefix="pyload_cookies_%s" % name, delete=False) + cookieFile = th.name + th.close() req = Request(cookieFile) self.requests.append((pluginName, account, req)) -- cgit v1.2.3