ソースを参照

Fix bugs in launcher script

oz123 11 年 前
コミット
dee7e79e50
1 ファイル変更10 行追加12 行削除
  1. 10 12
      scripts/pwman3

+ 10 - 12
scripts/pwman3

@@ -19,6 +19,7 @@
 #============================================================================
 # Copyright (C) 2006 Ivan Kelly <ivan@ivankelly.net>
 #============================================================================
+from __future__ import print_function
 import os
 import os.path
 import argparse
@@ -109,14 +110,6 @@ try:
     enc = CryptoEngine.get()
 
     dbtype = config.get_value("Database", "type")
-    # if it is done here, we could do the following:
-    # if db.ver == 0.4 :
-    #     db = pwman.data.factory.create(dbtyp, new_version)
-    # else:
-    #     we use the old code untouched ... insecure, but
-    #     keeps backwards compatibility ...
-    # if the database file exists check it's version
-    # else: force version 0.4
     if os.path.exists(config.get_value("Database", "filename")):
         dbver = pwman.data.factory.check_db_version(dbtype)
         dbver = float(dbver.strip("\'"))
@@ -138,8 +131,13 @@ try:
     if dbver >= 0.4:
         cli = PwmanCliNew(db, xselpath, CLICallback)
     elif dbver < 0.4:
-        cli = PwmanCli(db, xselpath)
-        print cli._dbwarning
+        print("\n*** WARNNING: You are using the old database format"
+              " which is insecure."
+              " Please upgrade to the new database "
+              " format. Do note: support for this DB format will be dropped in"
+              " v0.5. This  database format is on hold. No bugs are fixead"
+              " Check the help (pwman3 -h) or look at the manpage which"
+              " explains how to proceed. ***")
         sys.exit(0)
 except SystemExit, e:
     sys.exit(e)
@@ -148,11 +146,11 @@ try:
     try:
         cli.cmdloop()
     except KeyboardInterrupt, e:
-        print e
+        print (e)
 finally:
     try:
         if _saveconfig:
             config.save(args.cfile)
     except Exception, e:
-        print "Error: %s" % (e)
+        print ("Error: %s" % e )
         sys.exit(-1)