summaryrefslogtreecommitdiffstats
path: root/pyload/database
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-19 18:03:46 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-19 18:03:46 +0200
commite1c22fad3fffb485da400e4b34c094f201a2c72e (patch)
treed360610cdf65e2f1906d3cc9c891f6b80066859d /pyload/database
parentPEP-8, Python Zen, refactor and reduce code (part 7 in master module/database) (diff)
downloadpyload-e1c22fad3fffb485da400e4b34c094f201a2c72e.tar.xz
range -> xrange
Diffstat (limited to 'pyload/database')
-rw-r--r--pyload/database/Backend.py2
-rw-r--r--pyload/database/File.py2
-rw-r--r--pyload/database/User.py4
3 files changed, 4 insertions, 4 deletions
diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py
index 8b537511e..b6540b2be 100644
--- a/pyload/database/Backend.py
+++ b/pyload/database/Backend.py
@@ -85,7 +85,7 @@ class DatabaseJob(object):
frame = self.frame.f_back
output = ""
- for _i in range(5):
+ for _i in xrange(5):
output += "\t%s:%s, %s\n" % (basename(frame.f_code.co_filename), frame.f_lineno, frame.f_code.co_name)
frame = frame.f_back
del frame
diff --git a/pyload/database/File.py b/pyload/database/File.py
index d97dc7c5e..a49ba6d3a 100644
--- a/pyload/database/File.py
+++ b/pyload/database/File.py
@@ -670,7 +670,7 @@ class FileMethods(object):
def addLinks(self, links, package):
""" links is a list of tupels (url, plugin)"""
order = self._nextFileOrder(package)
- orders = [order + x for x in range(len(links))]
+ orders = [order + x for x in xrange(len(links))]
links = [(x[0], x[0], ".".join((x[1], x[2])), package, o) for x, o in zip(links, orders)]
self.c.executemany('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', links)
diff --git a/pyload/database/User.py b/pyload/database/User.py
index df510c54f..2aedc3bba 100644
--- a/pyload/database/User.py
+++ b/pyload/database/User.py
@@ -30,7 +30,7 @@ class UserMethods(object):
@style.queue
def addUser(db, user, password):
- salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in range(0, 5)])
+ salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in xrange(0, 5)])
h = sha1(salt + password)
password = salt + h.hexdigest()
@@ -53,7 +53,7 @@ class UserMethods(object):
pw = r[2][5:]
h = sha1(salt + oldpw)
if h.hexdigest() == pw:
- salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in range(0, 5)])
+ salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for _i in xrange(0, 5)])
h = sha1(salt + newpw)
password = salt + h.hexdigest()