Преглед изворни кода

Fix for old database format!

oz123 пре 11 година
родитељ
комит
776d06e78c
2 измењених фајлова са 4 додато и 8 уклоњено
  1. 2 0
      pwman/data/factory.py
  2. 2 8
      scripts/pwman3

+ 2 - 0
pwman/data/factory.py

@@ -54,6 +54,8 @@ def create(dbtype, version=None, filename=None):
             db = sqlite.SQLiteDatabaseNewForm(filename)
         elif version == 0.4:
             db = sqlite.SQLiteDatabaseNewForm()
+        else:
+            db = None
     elif dbtype == "Postgresql":
         try:
             from pwman.data.drivers import postgresql

+ 2 - 8
scripts/pwman3

@@ -108,20 +108,14 @@ try:
     os.umask(umask)
 
     enc = CryptoEngine.get()
-
     dbtype = config.get_value("Database", "type")
+
     if os.path.exists(config.get_value("Database", "filename")):
         dbver = pwman.data.factory.check_db_version(dbtype)
         dbver = float(dbver.strip("\'"))
     else:
         dbver = 0.4
-    # the method create could create an old instance that
-    # accepts cPickle object or new style instance that
-    # accepts only strings.
-    # The user should be STRONGLY Prompted to CONVERT the
-    # database to the new format using a command line tool.
-    # version 0.5 pwman will depreciate that old and insecure
-    # code ...
+
     if args.dbconvert:
         dbconvertor = PwmanConvertDB(args, config)
         status = dbconvertor.run()