def dav_index(context, data):
    'List files in a WebDAV directory.'
    url = data.get('url')
    context.log.info(('Fetching WebDAV path: %s' % url))
    result = context.http.request('PROPFIND', url)
    for resp in result.xml.findall('./{DAV:}response'):
        href = resp.findtext('./{DAV:}href')
        if (href is None):
            continue
        child_url = urljoin(url, href)
        if (child_url == url):
            continue
        child = dict(data)
        child['url'] = child_url
        child['foreign_id'] = child_url
        child['file_name'] = _get_url_file_name(href)
        rule = 'file'
        if (resp.find('.//{DAV:}collection') is not None):
            rule = 'folder'
        context.emit(data=child, rule=rule)
List files in a WebDAV directory.
def dav_index(context, data):
    
    url = data.get('url')
    context.log.info(('Fetching WebDAV path: %s' % url))
    result = context.http.request('PROPFIND', url)
    for resp in result.xml.findall('./{DAV:}response'):
        href = resp.findtext('./{DAV:}href')
        if (href is None):
            continue
        child_url = urljoin(url, href)
        if (child_url == url):
            continue
        child = dict(data)
        child['url'] = child_url
        child['foreign_id'] = child_url
        child['file_name'] = _get_url_file_name(href)
        rule = 'file'
        if (resp.find('.//{DAV:}collection') is not None):
            rule = 'folder'
        context.emit(data=child, rule=rule)