summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-02-06 12:05:26 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-02-06 12:05:26 +0100
commit392785e31a47adec0550bfeb51666fe92503f22d (patch)
tree8b87cc530c26f92c2cccebf67c857370e53687ef
parentwebif dlc upload fix (diff)
downloadpyload-392785e31a47adec0550bfeb51666fe92503f22d.tar.xz
some fixes
-rw-r--r--module/DatabaseBackend.py3
-rw-r--r--module/UserDatabase.py8
-rw-r--r--module/plugins/captcha/captcha.py3
-rw-r--r--module/web/webinterface.py6
-rwxr-xr-xpyLoadCore.py1
5 files changed, 10 insertions, 11 deletions
diff --git a/module/DatabaseBackend.py b/module/DatabaseBackend.py
index ca4ab1e56..d74950855 100644
--- a/module/DatabaseBackend.py
+++ b/module/DatabaseBackend.py
@@ -126,6 +126,8 @@ class DatabaseBackend(Thread):
j = self.jobs.get()
self.transactionLock.acquire()
if j == "quit":
+ self.c.close()
+ self.conn.close()
self.transactionLock.release()
break
j.processJob()
@@ -139,7 +141,6 @@ class DatabaseBackend(Thread):
def shutdown(self):
self.conn.commit()
self.jobs.put("quit")
- self.conn.close()
def _checkVersion(self):
""" check db version and delete it if needed"""
diff --git a/module/UserDatabase.py b/module/UserDatabase.py
index 471363cf9..7863e16b8 100644
--- a/module/UserDatabase.py
+++ b/module/UserDatabase.py
@@ -25,7 +25,7 @@ import random
class UserMethods():
@style.queue
def checkAuth(db, user, password):
- c = db.createCursor()
+ c = db.c
c.execute('SELECT name, password, role, permission, template FROM "users" WHERE name=?', (user, ))
r = c.fetchone()
if not r:
@@ -43,7 +43,7 @@ class UserMethods():
h = sha1(salt + password)
password = salt + h.hexdigest()
- c = db.createCursor()
+ c = db.c
c.execute('SELECT name FROM users WHERE name=?', (user, ))
if c.fetchone() is not None:
c.execute('UPDATE users SET password=? WHERE name=?', (password, user))
@@ -52,7 +52,7 @@ class UserMethods():
@style.queue
def listUsers(db):
- c = db.createCursor()
+ c = db.c
c.execute('SELECT name FROM users')
users = []
for row in c.fetchall():
@@ -61,7 +61,7 @@ class UserMethods():
@style.queue
def removeUser(db, user):
- c = db.createCursor()
+ c = db.c
c.execute('SELECT name FROM users WHERE name=?', (user, ))
if c.fetchone() is not None:
c.execute('DELETE FROM users WHERE name=?', (user, ))
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py
index 1da269dc6..4cbb736c1 100644
--- a/module/plugins/captcha/captcha.py
+++ b/module/plugins/captcha/captcha.py
@@ -57,6 +57,8 @@ class OCR(object):
popen = subprocess.Popen(command, bufsize = -1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
popen.wait()
output = popen.stdout.read() +" | "+ popen.stderr.read()
+ popen.stdout.close()
+ popen.stderr.close()
self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output))
def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True):
@@ -108,7 +110,6 @@ class OCR(object):
self.result_captcha = ""
self.logger.debug(self.result_captcha)
-
try:
os.remove(tmp.name)
os.remove(tmpTxt.name)
diff --git a/module/web/webinterface.py b/module/web/webinterface.py
index f6982287d..ea649c835 100644
--- a/module/web/webinterface.py
+++ b/module/web/webinterface.py
@@ -20,7 +20,7 @@
import sys
import gettext
-from os.path import join, abspath,dirname, exists
+from os.path import join, abspath, dirname, exists
from os import makedirs
PROJECT_DIR = abspath(dirname(__file__))
@@ -34,7 +34,7 @@ import bottle
from bottle import run, app
from jinja2 import Environment, FileSystemLoader, FileSystemBytecodeCache
-from middlewares import StripPathMiddleware, GZipMiddleWare, PrefixMiddleware
+from middlewares import StripPathMiddleware, GZipMiddleWare
try:
import module.web.ServerThread
@@ -115,7 +115,6 @@ session_opts = {
}
web = StripPathMiddleware(SessionMiddleware(app(), session_opts))
-web = PrefixMiddleware(web)
web = GZipMiddleWare(web)
import pyload_app
@@ -143,5 +142,4 @@ def run_fcgi(host="0.0.0.0", port="8000"):
if __name__ == "__main__":
-
run(app=web, port=8001)
diff --git a/pyLoadCore.py b/pyLoadCore.py
index d9c451002..1de5e20eb 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -298,7 +298,6 @@ class Core(object):
self.check_install("Crypto", _("pycrypto to decode container files"))
#img = self.check_install("Image", _("Python Image Libary (PIL) for captcha reading"))
#self.check_install("pycurl", _("pycurl to download any files"), True, True)
- self.check_install("django", _("Django for webinterface"))
self.check_file("tmp", _("folder for temporary files"), True)
#tesser = self.check_install("tesseract", _("tesseract for captcha reading"), False) if os.name != "nt" else True