mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +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
|
||||
|
||||
|
||||
def load_status(basepath, status_name):
|
||||
full_path = os.path.join(expand_path(basepath), status_name)
|
||||
def load_status(path, status_name):
|
||||
full_path = expand_path(os.path.join(path, status_name))
|
||||
if not os.path.exists(full_path):
|
||||
return {}
|
||||
with open(full_path) as f:
|
||||
return dict(json.loads(line) for line in f)
|
||||
|
||||
|
||||
def save_status(basepath, status_name, status):
|
||||
full_path = os.path.join(basepath, status_name)
|
||||
def save_status(path, status_name, status):
|
||||
full_path = expand_path(os.path.join(path, status_name))
|
||||
base_path = os.path.dirname(full_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:
|
||||
side = 'a' if e.empty_storage is a else 'b'
|
||||
storage = e.empty_storage
|
||||
cli_logger.error('{collection_description}: Storage "{side}" '
|
||||
'({storage}) was completely emptied. Use '
|
||||
'"--force-delete {status_name}" to synchronize that '
|
||||
'emptyness to the other side, or delete the status '
|
||||
'by yourself to restore the items from the non-empty '
|
||||
'side.'.format(**locals()))
|
||||
cli_logger.critical(
|
||||
'{collection_description}: Storage "{side}" ({storage}) was '
|
||||
'completely emptied. Use "--force-delete {status_name}" to '
|
||||
'synchronize that emptyness to the other side, or delete the '
|
||||
'status by yourself to restore the items from the non-empty '
|
||||
'side.'.format(**locals())
|
||||
)
|
||||
sys.exit(1)
|
||||
save_status(general['status_path'], status_name, status)
|
||||
|
|
|
|||
Loading…
Reference in a new issue