summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-21 20:50:05 +0200
committerGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-21 20:50:05 +0200
commitce9e0c03e131162523ec949fc66b6802920fcd3b (patch)
treeb82a8b5fc0a309f69733b0a004284f4ef45833d8
parenthotfix 2 (diff)
downloadpyload-ce9e0c03e131162523ec949fc66b6802920fcd3b.tar.xz
revert for merge
-rw-r--r--pyload/database/Backend.py22
-rw-r--r--pyload/network/HTTPRequest.py2
2 files changed, 11 insertions, 13 deletions
diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py
index 2f112bea4..b6540b2be 100644
--- a/pyload/database/Backend.py
+++ b/pyload/database/Backend.py
@@ -175,20 +175,18 @@ class DatabaseBackend(Thread):
f.write(str(DB_VERSION))
return
- v = 0
- with open("files.version", "rb") as f:
+ with open("files.version", "wb+") as f:
v = int(f.read().strip())
- if v < DB_VERSION:
- if v < 2:
- try:
- self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version."))
- except Exception:
- print "Filedatabase was deleted due to incompatible version."
- remove("files.version")
- move("files.db", "files.backup.db")
- with open("files.version", "wb") as f:
+ if v < DB_VERSION:
+ if v < 2:
+ try:
+ self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version."))
+ except Exception:
+ print "Filedatabase was deleted due to incompatible version."
+ remove("files.version")
+ move("files.db", "files.backup.db")
f.write(str(DB_VERSION))
- return v
+ return v
def _convertDB(self, v):
diff --git a/pyload/network/HTTPRequest.py b/pyload/network/HTTPRequest.py
index 74b83cf12..92ce6ec4b 100644
--- a/pyload/network/HTTPRequest.py
+++ b/pyload/network/HTTPRequest.py
@@ -24,7 +24,7 @@ def myurlencode(data):
data = dict(data)
return urlencode(dict((encode(x), encode(y)) for x, y in data.iteritems()))
-bad_headers = range(400, 404) + range(405, 418) + range(500, 506)
+bad_headers = xrange(400, 404) + xrange(405, 418) + xrange(500, 506)
class BadHeader(Exception):