added sync_with_gateway change function in wnf.py
This commit is contained in:
parent
dae6e1e6a2
commit
bae6908bdc
@ -1 +1 @@
|
||||
383
|
||||
384
|
16
wnf.py
16
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user