[client] Correct display of sync status.

Should display "auto sync is turned off" when auto-sync is disabled.
This commit is contained in:
Jiaqiang Xu 2013-04-11 14:27:14 +08:00
parent aa86471ef2
commit 30b0f6ca73
3 changed files with 8 additions and 2 deletions

View File

@ -533,7 +533,8 @@ def seaf_status(args):
print "# Name\tStatus"
repos = seafile_rpc.get_repo_list(-1, -1)
for repo in repos:
if not repo.auto_sync:
auto_sync_enabled = seafile_rpc.is_auto_sync_enabled()
if not auto_sync_enabled or not repo.auto_sync:
print "%s\t%s" % (repo.name, "auto sync disabled")
continue

View File

@ -150,6 +150,10 @@ class SeafileRpcClient(ccnet.RpcClientBase):
pass
get_repo_sync_info = seafile_get_repo_sync_info
@searpc_func("int", [])
def seafile_is_auto_sync_enabled():
pass
is_auto_sync_enabled = seafile_is_auto_sync_enabled
###### Property Management #########

View File

@ -319,7 +319,8 @@ class repo_sync_status:
# No sync task yet: seafile maybe have just been started
sync_status['state'] = 'waiting for sync'
if sync_status['state'] == 'waiting for sync' and not repo.props.auto_sync:
auto_sync_enabled = seafile_rpc.is_auto_sync_enabled()
if not auto_sync_enabled or not repo.props.auto_sync:
sync_status['state'] = 'auto sync is turned off'
return json.dumps(sync_status)