示例#1
0
 def get_names():
     """Extracts all names from references in ``hreferences`` and adds
        404 responses for invalid references to ``multistatus``.
        If the whole collections is referenced ``collection_requested``
        gets set to ``True``."""
     nonlocal collection_requested
     for hreference in hreferences:
         try:
             name = pathutils.name_from_path(hreference, collection)
         except ValueError as e:
             logger.warning("Skipping invalid path %r in REPORT request"
                            " on %r: %s", hreference, path, e)
             response = xml_item_response(base_prefix, hreference,
                                          found_item=False)
             multistatus.append(response)
             continue
         if name:
             # Reference is an item
             yield name
         else:
             # Reference is a collection
             collection_requested = True
示例#2
0
文件: report.py 项目: Kozea/Radicale
 def get_names():
     """Extracts all names from references in ``hreferences`` and adds
        404 responses for invalid references to ``multistatus``.
        If the whole collections is referenced ``collection_requested``
        gets set to ``True``."""
     nonlocal collection_requested
     for hreference in hreferences:
         try:
             name = pathutils.name_from_path(hreference, collection)
         except ValueError as e:
             logger.warning("Skipping invalid path %r in REPORT request"
                            " on %r: %s", hreference, path, e)
             response = xml_item_response(base_prefix, hreference,
                                          found_item=False)
             multistatus.append(response)
             continue
         if name:
             # Reference is an item
             yield name
         else:
             # Reference is a collection
             collection_requested = True