From b61e1467ee19ca96782248c0189424334d5980b7 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 7 May 2011 10:44:36 +0200 Subject: hooks methods callable via rpc, closed #299 --- module/plugins/Account.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'module/plugins/Account.py') diff --git a/module/plugins/Account.py b/module/plugins/Account.py index b8de4ddf0..e8ca26749 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -22,7 +22,7 @@ from random import choice from time import time from traceback import print_exc -from module.utils import compare_time +from module.utils import compare_time, parseFileSize class WrongPassword(Exception): pass @@ -189,17 +189,7 @@ class Account(): return False if self.selectAccount() == (None, None) else True def parseTraffic(self, string): #returns kbyte - string = string.strip().lower() - p = re.compile(r"(\d+[\.,]\d+)(.*)") - m = p.match(string) - if m: - traffic = float(m.group(1).replace(",", ".")) - unit = m.group(2).strip() - if unit == "gb" or unit == "gig" or unit == "gbyte" or unit == "gigabyte": - traffic *= 1024*1024 - elif unit == "mb" or unit == "megabyte" or unit == "mbyte" or unit == "mib": - traffic *= 1024 - return traffic + return parseFileSize(string) / 1024 def wrongPassword(self): raise WrongPassword -- cgit v1.2.3