diff options
Diffstat (limited to 'pyload/database')
| -rw-r--r-- | pyload/database/DatabaseBackend.py | 20 | ||||
| -rw-r--r-- | pyload/database/FileDatabase.py | 6 | ||||
| -rw-r--r-- | pyload/database/StorageDatabase.py | 2 | ||||
| -rw-r--r-- | pyload/database/UserDatabase.py | 2 | 
4 files changed, 15 insertions, 15 deletions
diff --git a/pyload/database/DatabaseBackend.py b/pyload/database/DatabaseBackend.py index b25a3c32e..8bde60335 100644 --- a/pyload/database/DatabaseBackend.py +++ b/pyload/database/DatabaseBackend.py @@ -27,12 +27,12 @@ from pyload.utils import chmod  try:      from pysqlite2 import dbapi2 as sqlite3 -except: +except Exception:      import sqlite3  DB_VERSION = 4 -class style: +class style(object):      db = None      @classmethod @@ -63,7 +63,7 @@ class style:                  return cls.db.async(f, *args, **kwargs)          return x -class DatabaseJob: +class DatabaseJob(object):      def __init__(self, f, *args, **kwargs):          self.done = Event() @@ -96,7 +96,7 @@ class DatabaseJob:              print_exc()              try:                  print "Database Error @", self.f.__name__, self.args[1:], self.kwargs, e -            except: +            except Exception:                  pass              self.exception = e @@ -170,7 +170,7 @@ class DatabaseBackend(Thread):              if v < 2:                  try:                      self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) -                except: +                except Exception:                      print "Filedatabase was deleted due to incompatible version."                  remove("files.version")                  move("files.db", "files.backup.db") @@ -182,10 +182,10 @@ class DatabaseBackend(Thread):      def _convertDB(self, v):          try:              getattr(self, "_convertV%i" % v)() -        except: +        except Exception:              try:                  self.core.log.error(_("Filedatabase could NOT be converted.")) -            except: +            except Exception:                  print "Filedatabase could NOT be converted."      #convert scripts start----------------------------------------------------- @@ -194,7 +194,7 @@ class DatabaseBackend(Thread):          self.c.execute('CREATE TABLE IF NOT EXISTS "storage" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "identifier" TEXT NOT NULL, "key" TEXT NOT NULL, "value" TEXT DEFAULT "")')          try:              self.manager.core.log.info(_("Database was converted from v2 to v3.")) -        except: +        except Exception:              print "Database was converted from v2 to v3."          self._convertV3() @@ -202,7 +202,7 @@ class DatabaseBackend(Thread):          self.c.execute('CREATE TABLE IF NOT EXISTS "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "email" TEXT DEFAULT "" NOT NULL, "password" TEXT NOT NULL, "role" INTEGER DEFAULT 0 NOT NULL, "permission" INTEGER DEFAULT 0 NOT NULL, "template" TEXT DEFAULT "default" NOT NULL)')          try:              self.manager.core.log.info(_("Database was converted from v3 to v4.")) -        except: +        except Exception:              print "Database was converted from v3 to v4."      #convert scripts end------------------------------------------------------- @@ -248,7 +248,7 @@ class DatabaseBackend(Thread):          if exists("pyload.db"):              try:                  self.core.log.info(_("Converting old Django DB")) -            except: +            except Exception:                  print "Converting old Django DB"              conn = sqlite3.connect('pyload.db')              c = conn.cursor() diff --git a/pyload/database/FileDatabase.py b/pyload/database/FileDatabase.py index 5bd1e5a5f..39e13fe29 100644 --- a/pyload/database/FileDatabase.py +++ b/pyload/database/FileDatabase.py @@ -28,11 +28,11 @@ from pyload.database import style, DatabaseBackend  try:      from pysqlite2 import dbapi2 as sqlite3 -except: +except Exception:      import sqlite3 -class FileHandler: +class FileHandler(object):      """Handles all request made to obtain information,      modify status or other request for links or packages""" @@ -572,7 +572,7 @@ class FileHandler:          """ restart all failed links """          self.db.restartFailed() -class FileMethods: +class FileMethods(object):      @style.queue      def filecount(self, queue):          """returns number of files in queue""" diff --git a/pyload/database/StorageDatabase.py b/pyload/database/StorageDatabase.py index c2473e7b7..30f12af17 100644 --- a/pyload/database/StorageDatabase.py +++ b/pyload/database/StorageDatabase.py @@ -19,7 +19,7 @@  from pyload.database import style  from pyload.database import DatabaseBackend -class StorageMethods: +class StorageMethods(object):      @style.queue      def setStorage(db, identifier, key, value):          db.c.execute("SELECT id FROM storage WHERE identifier=? AND key=?", (identifier, key)) diff --git a/pyload/database/UserDatabase.py b/pyload/database/UserDatabase.py index 59b0f6dbf..59734a518 100644 --- a/pyload/database/UserDatabase.py +++ b/pyload/database/UserDatabase.py @@ -22,7 +22,7 @@ import random  from DatabaseBackend import DatabaseBackend  from DatabaseBackend import style -class UserMethods: +class UserMethods(object):      @style.queue      def checkAuth(db, user, password):          c = db.c  | 
