summaryrefslogtreecommitdiffstats
path: root/module/plugins/Account.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-26 02:36:15 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-08-01 17:01:44 +0200
commita1495eb2f9502fdf29974458845f928025bedf53 (patch)
treeedaf85ed7f15823bfdc271e95d537c5671ea1f86 /module/plugins/Account.py
parent[UpdateManager] Disable reloadplugins schedule on plugin deactivation (diff)
downloadpyload-a1495eb2f9502fdf29974458845f928025bedf53.tar.xz
Prefer single quote for dict key
Diffstat (limited to 'module/plugins/Account.py')
-rw-r--r--module/plugins/Account.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 21f65816a..c4d5c982c 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -85,12 +85,12 @@ class Account(Base):
self.logWarning(
_("Could not login with account %(user)s | %(msg)s") % {"user": user
, "msg": _("Wrong Password")})
- success = 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})
- success = data["valid"] = False
+ success = data['valid'] = False
if self.core.debug:
print_exc()
else:
@@ -120,15 +120,15 @@ class Account(Base):
""" updates account and return true if anything changed """
if user in self.accounts:
- self.accounts[user]["valid"] = True #do not remove or accounts will not login
+ self.accounts[user]['valid'] = True #do not remove or accounts will not login
if password:
- self.accounts[user]["password"] = password
+ self.accounts[user]['password'] = password
self.relogin(user)
return True
if options:
- before = self.accounts[user]["options"]
- self.accounts[user]["options"].update(options)
- return self.accounts[user]["options"] != before
+ before = self.accounts[user]['options']
+ self.accounts[user]['options'].update(options)
+ return self.accounts[user]['options'] != before
else:
self.accounts[user] = {"password": password, "options": options, "valid": True}
self._login(user, self.accounts[user])
@@ -168,7 +168,7 @@ class Account(Base):
self.logDebug("Account Info: %s" % str(infos))
- infos["timestamp"] = time()
+ infos['timestamp'] = time()
self.infos[name] = infos
elif "timestamp" in self.infos[name] and self.infos[name][
"timestamp"] + self.info_threshold * 60 < time():
@@ -180,7 +180,7 @@ class Account(Base):
def isPremium(self, user):
info = self.getAccountInfo(user)
- return info["premium"]
+ return info['premium']
def loadAccountInfo(self, name, req=None):
"""this should be overwritten in account plugin,\
@@ -193,9 +193,9 @@ class Account(Base):
return {
"validuntil": None, # -1 for unlimited
"login": name,
- #"password": self.accounts[name]["password"], #@XXX: security
- "options": self.accounts[name]["options"],
- "valid": self.accounts[name]["valid"],
+ #"password": self.accounts[name]['password'], #@XXX: security
+ "options": self.accounts[name]['options'],
+ "valid": self.accounts[name]['valid'],
"trafficleft": None, # in kb, -1 for unlimited
"maxtraffic": None,
"premium": True, #useful for free accounts
@@ -231,12 +231,12 @@ class Account(Base):
""" returns an valid account name and data"""
usable = []
for user, data in self.accounts.iteritems():
- if not data["valid"]: continue
+ if not data['valid']: continue
- if "time" in data["options"] and data["options"]["time"]:
+ if "time" in data['options'] and data['options']['time']:
time_data = ""
try:
- time_data = data["options"]["time"][0]
+ time_data = data['options']['time'][0]
start, end = time_data.split("-")
if not compare_time(start.split(":"), end.split(":")):
continue
@@ -245,10 +245,10 @@ class Account(Base):
if user in self.infos:
if "validuntil" in self.infos[user]:
- if self.infos[user]["validuntil"] > 0 and time() > self.infos[user]["validuntil"]:
+ if self.infos[user]['validuntil'] > 0 and time() > self.infos[user]['validuntil']:
continue
if "trafficleft" in self.infos[user]:
- if self.infos[user]["trafficleft"] == 0:
+ if self.infos[user]['trafficleft'] == 0:
continue
usable.append((user, data))