diff --git a/vdirsyncer/cli/tasks.py b/vdirsyncer/cli/tasks.py index de3dcca..9ded076 100644 --- a/vdirsyncer/cli/tasks.py +++ b/vdirsyncer/cli/tasks.py @@ -9,6 +9,7 @@ from .utils import CliError, JobFailed, cli_logger, coerce_native, \ save_status, storage_class_from_config, storage_instance_from_config from ..sync import sync +from ..utils.compat import to_unicode def prepare_pair(wq, pair_name, collections, config, callback, **kwargs): @@ -21,6 +22,9 @@ def prepare_pair(wq, pair_name, collections, config, callback, **kwargs): # spawn one worker less because we can reuse the current one new_workers = -1 for collection_name in (collections or all_collections): + # XXX: PY2 hack + if collection_name is not None: + collection_name = to_unicode(collection_name, 'utf-8') try: config_a, config_b = all_collections[collection_name] except KeyError: diff --git a/vdirsyncer/storage/base.py b/vdirsyncer/storage/base.py index b36f58c..b29ab48 100644 --- a/vdirsyncer/storage/base.py +++ b/vdirsyncer/storage/base.py @@ -114,7 +114,13 @@ class Storage(with_metaclass(StorageMeta)): raise NotImplementedError() def __repr__(self): - return self.instance_name or '<{}(**{})>'.format( + try: + if self.instance_name: + return str(self.instance_name) + except ValueError: + pass + + return '<{}(**{})>'.format( self.__class__.__name__, dict((x, getattr(self, x)) for x in self._repr_attributes) )