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 from vdirsyncer.storage.memory import MemoryStorage
all, required = utils.get_class_init_args(MemoryStorage) all, required = utils.get_class_init_args(MemoryStorage)
assert all == set(['fileext', 'collection', 'read_only', 'instance_name', assert all == set(['fileext', 'collection', 'read_only', 'instance_name'])
'collection_human'])
assert not required assert not required

View file

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

View file

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