Przeglądaj źródła

Use the right namespace for adressbook tags

Guillaume Ayoub 13 lat temu
rodzic
commit
ea94ec919e
1 zmienionych plików z 8 dodań i 6 usunięć
  1. 8 6
      radicale/xmlutils.py

+ 8 - 6
radicale/xmlutils.py

@@ -283,12 +283,14 @@ def _propfind_response(path, item, props, user):
                 if item.is_principal:
                     tag = ET.Element(_tag("D", "principal"))
                     element.append(tag)
-                if item.is_leaf(item.path):
-                    tag = ET.Element(_tag("C", item.resource_type))
-                    element.append(tag)
-                if not item.exists and item.resource_type:
-                    # Collection not stored yet, but guessed resource type
-                    tag = ET.Element(_tag("C", item.resource_type))
+                if item.is_leaf(item.path) or (
+                        not item.exists and item.resource_type):
+                    # 2nd case happens when the collection is not stored yet,
+                    # but the resource type is guessed
+                    if item.resource_type == "addressbook":
+                        tag = ET.Element(_tag("CR", item.resource_type))
+                    else:
+                        tag = ET.Element(_tag("C", item.resource_type))
                     element.append(tag)
                 tag = ET.Element(_tag("D", "collection"))
                 element.append(tag)