|
@@ -26,7 +26,6 @@ import sys
|
|
import re
|
|
import re
|
|
import shutil
|
|
import shutil
|
|
|
|
|
|
-_saveconfig = True
|
|
|
|
|
|
|
|
_db_warn = ("pwman3 detected that are using the old database format"
|
|
_db_warn = ("pwman3 detected that are using the old database format"
|
|
" which is insecure."
|
|
" which is insecure."
|
|
@@ -66,7 +65,7 @@ def parser_options():
|
|
return parser
|
|
return parser
|
|
|
|
|
|
|
|
|
|
-def get_conf():
|
|
|
|
|
|
+def get_conf(args):
|
|
config_dir = os.path.expanduser("~/.pwman")
|
|
config_dir = os.path.expanduser("~/.pwman")
|
|
|
|
|
|
if not os.path.isdir(config_dir):
|
|
if not os.path.isdir(config_dir):
|
|
@@ -112,22 +111,19 @@ def set_umask(config):
|
|
|
|
|
|
|
|
|
|
def set_db(args):
|
|
def set_db(args):
|
|
- global _saveconfig
|
|
|
|
if args.dbase:
|
|
if args.dbase:
|
|
config.set_value("Database", "filename", args.dbase)
|
|
config.set_value("Database", "filename", args.dbase)
|
|
- _saveconfig = False
|
|
|
|
|
|
+ config.set_value("Global", "save", "False")
|
|
|
|
|
|
|
|
|
|
def set_algorithm(args, config):
|
|
def set_algorithm(args, config):
|
|
- global _saveconfig
|
|
|
|
if args.algo:
|
|
if args.algo:
|
|
config.set_value("Encryption", "algorithm", args.algo)
|
|
config.set_value("Encryption", "algorithm", args.algo)
|
|
- _saveconfig = False
|
|
|
|
-
|
|
|
|
|
|
+ config.set_value("Global", "save", "False")
|
|
|
|
|
|
def get_conf_options(args, OSX):
|
|
def get_conf_options(args, OSX):
|
|
|
|
|
|
- config = get_conf()
|
|
|
|
|
|
+ config = get_conf(args)
|
|
xselpath = config.get_value("Global", "xsel")
|
|
xselpath = config.get_value("Global", "xsel")
|
|
if not xselpath:
|
|
if not xselpath:
|
|
set_xsel(config, OSX)
|
|
set_xsel(config, OSX)
|
|
@@ -216,7 +212,7 @@ def main(args):
|
|
except KeyboardInterrupt, e:
|
|
except KeyboardInterrupt, e:
|
|
print(e)
|
|
print(e)
|
|
|
|
|
|
- if _saveconfig:
|
|
|
|
|
|
+ if config.get_value("Global", "save") == "True":
|
|
try:
|
|
try:
|
|
config.save(args.cfile)
|
|
config.save(args.cfile)
|
|
except Exception, e:
|
|
except Exception, e:
|