mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Saner variable names
This commit is contained in:
parent
94eb60f352
commit
0c8eba1cd3
1 changed files with 11 additions and 10 deletions
|
|
@ -75,16 +75,16 @@ def load_config(fname, pair_options=('collections', 'conflict_resolution')):
|
||||||
return general, pairs, storages
|
return general, pairs, storages
|
||||||
|
|
||||||
|
|
||||||
def load_status(basepath, status_name):
|
def load_status(path, status_name):
|
||||||
full_path = os.path.join(expand_path(basepath), status_name)
|
full_path = expand_path(os.path.join(path, status_name))
|
||||||
if not os.path.exists(full_path):
|
if not os.path.exists(full_path):
|
||||||
return {}
|
return {}
|
||||||
with open(full_path) as f:
|
with open(full_path) as f:
|
||||||
return dict(json.loads(line) for line in f)
|
return dict(json.loads(line) for line in f)
|
||||||
|
|
||||||
|
|
||||||
def save_status(basepath, status_name, status):
|
def save_status(path, status_name, status):
|
||||||
full_path = os.path.join(basepath, status_name)
|
full_path = expand_path(os.path.join(path, status_name))
|
||||||
base_path = os.path.dirname(full_path)
|
base_path = os.path.dirname(full_path)
|
||||||
|
|
||||||
if os.path.isfile(base_path):
|
if os.path.isfile(base_path):
|
||||||
|
|
@ -301,11 +301,12 @@ def sync_collection(config_a, config_b, pair_name, collection, pair_options,
|
||||||
except exceptions.StorageEmpty as e:
|
except exceptions.StorageEmpty as e:
|
||||||
side = 'a' if e.empty_storage is a else 'b'
|
side = 'a' if e.empty_storage is a else 'b'
|
||||||
storage = e.empty_storage
|
storage = e.empty_storage
|
||||||
cli_logger.error('{collection_description}: Storage "{side}" '
|
cli_logger.critical(
|
||||||
'({storage}) was completely emptied. Use '
|
'{collection_description}: Storage "{side}" ({storage}) was '
|
||||||
'"--force-delete {status_name}" to synchronize that '
|
'completely emptied. Use "--force-delete {status_name}" to '
|
||||||
'emptyness to the other side, or delete the status '
|
'synchronize that emptyness to the other side, or delete the '
|
||||||
'by yourself to restore the items from the non-empty '
|
'status by yourself to restore the items from the non-empty '
|
||||||
'side.'.format(**locals()))
|
'side.'.format(**locals())
|
||||||
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
save_status(general['status_path'], status_name, status)
|
save_status(general['status_path'], status_name, status)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue