From cf622a75eacdd38e9873f036dc7400982bf5c5a2 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Fri, 23 Jan 2015 23:57:24 +0100 Subject: [PATCH] Don't print config variables twice CarddavStorage doesn't override the __init__ method, which causes the same spec from DavStorage to be loaded and printed twice. --- vdirsyncer/cli/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index dcb51e1..0cdaaa4 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -542,9 +542,14 @@ def format_storage_config(cls, header=True): from ..storage.base import Storage from ..utils import get_class_init_specs + handled = set() for spec in get_class_init_specs(cls, stop_at=Storage): defaults = dict(zip(spec.args[-len(spec.defaults):], spec.defaults)) for key in spec.args[1:]: + if key in handled: + continue + handled.add(key) + comment = '' if key not in defaults else '#' value = defaults.get(key, '...') yield '{}{} = {}'.format(comment, key, json.dumps(value))