diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-07-06 20:44:58 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-07-06 20:44:58 +0200 |
commit | fb24e9697b4947e805d55e1c84bc6c4e301362f7 (patch) | |
tree | c7cbe849e753ed3bcfa4c0c1513c0ecab7d3ef25 | |
parent | [README] Better intro (now with badges) (diff) | |
download | pyload-fb24e9697b4947e805d55e1c84bc6c4e301362f7.tar.xz |
Fix account checkLogin
-rw-r--r-- | module/plugins/Account.py | 34 | ||||
-rw-r--r-- | module/plugins/accounts/Ftp.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/Http.py | 2 |
3 files changed, 21 insertions, 17 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index e75fc0ecb..f6c59ae25 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -36,16 +36,16 @@ class Account(Base): associated hoster plugin. Plugin should also provide `loadAccountInfo` """ __name__ = "Account" - __version__ = "0.2" + __version__ = "0.3" __type__ = "account" __description__ = """Base account plugin""" __author_name__ = "mkaay" __author_mail__ = "mkaay@mkaay.de" - #: after that time [in minutes] pyload will relogin the account - login_timeout = 600 - #: account data will be reloaded after this time - info_threshold = 600 + #: after that time (in minutes) pyload will relogin the account + login_timeout = 10 * 60 + #: after that time (in minutes) account data will be reloaded + info_threshold = 10 * 60 def __init__(self, manager, accounts): @@ -84,17 +84,20 @@ class Account(Base): self.logWarning( _("Could not login with account %(user)s | %(msg)s") % {"user": user , "msg": _("Wrong Password")}) - data["valid"] = False - + success = data["valid"] = False except Exception, e: self.logWarning( _("Could not login with account %(user)s | %(msg)s") % {"user": user , "msg": e}) - data["valid"] = False + success = data["valid"] = False if self.core.debug: print_exc() + else: + success = True finally: - if req: req.close() + if req: + req.close() + return success def relogin(self, user): req = self.getAccountRequest(user) @@ -104,7 +107,7 @@ class Account(Base): if user in self.infos: del self.infos[user] #delete old information - self._login(user, self.accounts[user]) + return self._login(user, self.accounts[user]) def setAccounts(self, accounts): self.accounts = accounts @@ -284,9 +287,10 @@ class Account(Base): def checkLogin(self, user): """ checks if user is still logged in """ if user in self.timestamps: - if self.timestamps[user] + self.login_timeout * 60 < time(): + if self.login_timeout > 0 and self.timestamps[user] + login_timeout * 60 > time(): self.logDebug("Reached login timeout for %s" % user) - self.relogin(user) - return False - - return True + return self.relogin(user) + else: + return True + else: + return False diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py index b454cba7a..18e25c716 100644 --- a/module/plugins/accounts/Ftp.py +++ b/module/plugins/accounts/Ftp.py @@ -11,4 +11,4 @@ class Ftp(Account): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - login_timeout = info_threshold = 1000000 + login_timeout = info_threshold = -1 #: Unlimited diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py index e2f236e41..932b0aa64 100644 --- a/module/plugins/accounts/Http.py +++ b/module/plugins/accounts/Http.py @@ -11,4 +11,4 @@ class Http(Account): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - login_timeout = info_threshold = 1000000 + login_timeout = info_threshold = -1 #: Unlimited |