diff --git a/version.num b/version.num index be6c136492..e41567feb8 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -383 \ No newline at end of file +384 \ No newline at end of file diff --git a/wnf.py b/wnf.py index cc82eb56ed..4f18187fcc 100755 --- a/wnf.py +++ b/wnf.py @@ -56,7 +56,8 @@ def setup_options(): help="export doc") parser.add_option('--install', nargs=3, metavar = "rootpassword dbname source", help="install fresh db") - + parser.add_option('--sync_with_gateway', nargs=1, metavar = "1/0", help="Set or Unset Sync with Gateway") + return parser.parse_args() def run(): @@ -138,7 +139,18 @@ def run(): from webnotes.install_lib.install import Installer inst = Installer('root', options.install[0]) inst.import_from_db(options.install[1], source_path=options.install[2], \ - password='admin', verbose = 1) + password='admin', verbose = 1) + + elif options.sync_with_gateway: + if int(options.sync_with_gateway[0]) in [0, 1]: + webnotes.conn.begin() + webnotes.conn.sql("""\ + UPDATE `tabSingles` SET value=%s + WHERE field='sync_with_gateway' AND doctype='Control Panel'""", int(options.sync_with_gateway[0])) + webnotes.conn.commit() + webnotes.message_log.append("sync_with_gateway set to %s" % options.sync_with_gateway[0]) + else: + webnotes.message_log.append("ERROR: sync_with_gateway can be either 0 or 1") # print messages if webnotes.message_log: