How to use the vdirsyncer.exceptions.UnsupportedMetadataError function in vdirsyncer

To help you get started, we’ve selected a few vdirsyncer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pimutils / vdirsyncer / tests / storage / __init__.py View on Github external
def test_metadata(self, requires_metadata, s):
        if not getattr(self, 'dav_server', ''):
            assert not s.get_meta('color')
            assert not s.get_meta('displayname')

        try:
            s.set_meta('color', None)
            assert not s.get_meta('color')
            s.set_meta('color', '#ff0000')
            assert s.get_meta('color') == '#ff0000'
        except exceptions.UnsupportedMetadataError:
            pass

        for x in ('hello world', 'hello wörld'):
            s.set_meta('displayname', x)
            rv = s.get_meta('displayname')
            assert rv == x
            assert isinstance(rv, str)
github pimutils / vdirsyncer / vdirsyncer / native.py View on Github external
errors.check_exception(e[0])
    except errors.Error.ItemNotFound as e:
        raise exceptions.NotFoundError(e) from e
    except errors.Error.ItemAlreadyExisting as e:
        raise exceptions.AlreadyExistingError(e) from e
    except errors.Error.WrongEtag as e:
        raise exceptions.WrongEtagError(e) from e
    except errors.Error.ReadOnly as e:
        raise exceptions.ReadOnlyError(e) from e
    except errors.Error.UnsupportedVobject as e:
        raise exceptions.UnsupportedVobjectError(e) from e
    except (errors.Error.BadDiscoveryConfig,
            errors.Error.BadCollectionConfig) as e:
        raise TypeError(e) from e
    except errors.Error.MetadataValueUnsupported as e:
        raise exceptions.UnsupportedMetadataError(e) from e
github pimutils / vdirsyncer / vdirsyncer / storage / _rust.py View on Github external
def _map_meta_key(key):
    try:
        return {
            'color': native.lib.Color,
            'displayname': native.lib.Displayname
        }[key.lower()]
    except KeyError:
        raise exceptions.UnsupportedMetadataError()
github pimutils / vdirsyncer / vdirsyncer / storage / olddav.py View on Github external
def set_meta(self, key, value):
        try:
            tagname, namespace = self._property_table[key]
        except KeyError:
            raise exceptions.UnsupportedMetadataError()

        lxml_selector = '{%s}%s' % (namespace, tagname)
        element = etree.Element(lxml_selector)
        element.text = normalize_meta_value(value)

        data = '''
            
                
                    
                        {}
                    
                
            
        '''.format(etree.tostring(element, encoding='unicode')).encode('utf-8')

        self.session.request(
github pimutils / vdirsyncer / vdirsyncer / storage / dav.py View on Github external
def set_meta(self, key, value):
        try:
            tagname, namespace = self._property_table[key]
        except KeyError:
            raise exceptions.UnsupportedMetadataError()

        lxml_selector = '{{{}}}{}'.format(namespace, tagname)
        element = etree.Element(lxml_selector)
        element.text = normalize_meta_value(value)

        data = '''
            
                
                    
                        {}
                    
                
            
        '''.format(etree.tostring(element, encoding='unicode')).encode('utf-8')

        self.session.request(
github pimutils / vdirsyncer / vdirsyncer / storage / dav.py View on Github external
def get_meta(self, key):
        try:
            tagname, namespace = self._property_table[key]
        except KeyError:
            raise exceptions.UnsupportedMetadataError()

        xpath = '{{{}}}{}'.format(namespace, tagname)
        data = '''
            
                
                    {}
                
            
        '''.format(
            etree.tostring(etree.Element(xpath), encoding='unicode')
        ).encode('utf-8')

        headers = self.session.get_default_headers()
        headers['Depth'] = '0'

        response = self.session.request(