在caldav中如何报告1年以上的时间范围

问题描述 投票:0回答:1

我正在尝试按时间范围报告caldav过滤中的事件etag。所有工作都很好,期望时间范围大于1年。我总是收到消息:过去的时间范围值太远。必须在20190430或之后]

这里是请求:

<c:calendar-query xmlns:A='DAV:' xmlns:c='urn:ietf:params:xml:ns:caldav'>
    <A:prop>
        <A:getetag/>
    </A:prop>
    <c:filter>
        <c:comp-filter name='VCALENDAR'>
            <c:comp-filter name='VEVENT'>
                    <c:time-range start='20190424T184806Z' end='20190425T184806Z'/>
            </c:comp-filter>
        </c:comp-filter>
    </c:filter>
</c:calendar-query>";

和回复:

HTTP/1.1 403 Forbidden Date: Wed, 29 Apr 2020 16:48:06 GMT Server: Twisted/13.2.0 TwistedWeb/9.0.0 Content-Length: 289 Strict-Transport-Security: max-age=604800 Content-Type: text/xml DAV: 1, access-control, calendar-access, calendar-schedule, calendar-auto-schedule, calendar-availability, inbox-availability, calendar-proxy, calendarserver-private-events, calendarserver-private-comments, calendarserver-sharing, calendarserver-sharing-no-scheduling, calendar-query-extended, calendar-default-alarms, calendar-managed-attachments, calendarserver-partstat-changes, calendar-no-timezone, calendarserver-recurrence-split, extended-mkcol, calendarserver-principal-property-search, calendarserver-principal-search, calendarserver-home-sync MS-Author-Via: DAV Vary: User-Agent Connection: close Time-range value too far in the past. Must be on or after 20190430. 

我如何报告1年以上的事件?

xml request caldav
1个回答
0
投票

因此,从我收集到的信息中,我可以看到您的caldav服务器正在使用某种Twisted Caldav服务器(从未使用过,甚至从未使用过MacOS内置的caldav服务器)。我发现此Caldav服务器的实现似乎是此archived repo。在该存储库中,我找到了您提供的Exceptionhere

except TimeRangeLowerLimit, e:
    raise HTTPError(ErrorResponse(
        responsecode.FORBIDDEN,
        caldavxml.MinDateTime(),
        "Time-range value too far in the past. Must be on or after %s." % (str(e.limit),)(str(e.limit),)

查看TimeRangeLowerLimit Exception实现here

class TimeRangeLowerLimit(Exception):
    """
    A request for time-range information too far in the past cannot be satisfied.
    """

    def __init__(self, lowerLimit):
        self.limit = lowerLimit

似乎实际上有一个限制集。深入研究MinDateTimehere

class MinDateTime (CalDAVTextElement):
    """
    Specifies restrictions on a calendar collection.
    (CalDAV-access, RFC 4791 section 5.2.6)
    """
    name = "min-date-time"
    hidden = True
    protected = True

它指向5.2.6 in RFC 4791部分,其中说:

名称:最小日期时间

名称空间:urn:ietf:params:xml:ns:caldav

目的:提供一个DATE-TIME值,指示最早的日期和服务器愿意在任何DATE接受的时间(以UTC为单位)或日历中存储的日历对象资源中的DATE-TIME值集合。

尽管我一直以为这是输入限制,而不是搜索(报告)限制,这使我感到非常困惑。回到实现,从here中抛出异常:

# Determine if the start date is too early for the restricted range we
# are applying. If it is today or later we don't need to worry about truncation
# in the past.
minDate, _ignore_isEndDate = filter.getmintimerange()
if minDate >= today:
    minDate = None
if minDate is not None and config.FreeBusyIndexLowerLimitDays:
    truncateLowerLimit = today - Duration(days=config.FreeBusyIndexLowerLimitDays)
    if minDate < truncateLowerLimit:
        raise TimeRangeLowerLimit(truncateLowerLimit)

考虑条件if minDate is not None and config.FreeBusyIndexLowerLimitDays:,因为您想使用minDate(又名time-range的开始,所以似乎唯一可行的解​​决方案是在配置中以某种方式设置不同的FreeBusyIndexLowerLimitDays

[我从未在其他caldav实现中见过此问题(我主要使用Sabre),所以不幸的是,我不能为您提供更多帮助。

© www.soinside.com 2019 - 2024. All rights reserved.