From a1495eb2f9502fdf29974458845f928025bedf53 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 26 Jul 2014 02:36:15 +0200 Subject: Prefer single quote for dict key --- module/plugins/Account.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'module/plugins/Account.py') 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)) -- cgit v1.2.3