def _schedulePrivilegeSet(deliver): edited = False top_supported_privileges = [] for supported_privilege in davPrivilegeSet.childrenOfType(davxml.SupportedPrivilege): all_privilege = supported_privilege.childOfType(davxml.Privilege) if isinstance(all_privilege.children[0], davxml.All): all_description = supported_privilege.childOfType(davxml.Description) all_supported_privileges = list(supported_privilege.childrenOfType(davxml.SupportedPrivilege)) all_supported_privileges.append( davxml.SupportedPrivilege( davxml.Privilege(caldavxml.ScheduleDeliver() if deliver else caldavxml.ScheduleSend()), davxml.Description("schedule privileges for current principal", **{"xml:lang": "en"}), ), ) if config.Scheduling.CalDAV.OldDraftCompatibility: all_supported_privileges.append( davxml.SupportedPrivilege( davxml.Privilege(caldavxml.Schedule()), davxml.Description("old-style schedule privileges for current principal", **{"xml:lang": "en"}), ), ) top_supported_privileges.append( davxml.SupportedPrivilege(all_privilege, all_description, *all_supported_privileges) ) edited = True else: top_supported_privileges.append(supported_privilege) assert edited, "Structure of davPrivilegeSet changed in a way that I don't know how to extend for schedulePrivilegeSet" return davxml.SupportedPrivilegeSet(*top_supported_privileges)
def principalSearchPropertySet(self): props = [] for _ignore_field, _ignore_converter, description, xmlClass in self._fieldList: props.append( davxml.PrincipalSearchProperty( davxml.PropertyContainer(xmlClass()), davxml.Description(davxml.PCDATAElement(description), **{"xml:lang": "en"}), )) return davxml.PrincipalSearchPropertySet(*props)