Remove collection_human

This commit is contained in:
Markus Unterwaditzer 2015-07-06 16:13:35 +02:00
parent acf3ac0dcd
commit 31de43b4a9
3 changed files with 4 additions and 13 deletions

View file

@ -205,8 +205,7 @@ def test_get_class_init_args_on_storage():
from vdirsyncer.storage.memory import MemoryStorage
all, required = utils.get_class_init_args(MemoryStorage)
assert all == set(['fileext', 'collection', 'read_only', 'instance_name',
'collection_human'])
assert all == set(['fileext', 'collection', 'read_only', 'instance_name'])
assert not required

View file

@ -61,9 +61,6 @@ class Storage(with_metaclass(StorageMeta)):
# The machine-readable name of this collection.
collection = None
# The human-readable name of this collection.
collection_human = None
# A value of True means the storage does not support write-methods such as
# upload, update and delete. A value of False means the storage does
# support those methods.
@ -72,8 +69,7 @@ class Storage(with_metaclass(StorageMeta)):
# The attribute values to show in the representation of the storage.
_repr_attributes = ()
def __init__(self, instance_name=None, read_only=None, collection=None,
collection_human=None):
def __init__(self, instance_name=None, read_only=None, collection=None):
if read_only is None:
read_only = self.read_only
if self.read_only and not read_only:
@ -84,7 +80,6 @@ class Storage(with_metaclass(StorageMeta)):
instance_name = '{}/{}'.format(instance_name, collection)
self.instance_name = instance_name
self.collection = collection
self.collection_human = collection_human
@classmethod
def discover(cls, **kwargs):

View file

@ -93,7 +93,6 @@ class Discover(object):
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:resourcetype />
<d:displayname />
</d:prop>
</d:propfind>
"""
@ -177,22 +176,20 @@ class Discover(object):
if props.find('{*}resourcetype/{*}' + self._resourcetype) is None:
continue
displayname = getattr(props.find('{*}displayname'), 'text', '')
href = response.find('{*}href')
if href is None:
raise InvalidXMLResponse()
href = utils.compat.urlparse.urljoin(r.url, href.text)
if href not in done:
done.add(href)
yield {'href': href, 'displayname': displayname}
yield {'href': href}
def discover(self):
for c in self.find_collections():
url = c['href']
collection = _get_collection_from_url(url)
storage_args = dict(self.kwargs)
storage_args.update({'url': url, 'collection': collection,
'collection_human': c['displayname']})
storage_args.update({'url': url, 'collection': collection})
yield storage_args
def create(self, collection):