Merge branch 'master' of github.com:Kozea/Radicale

This commit is contained in:
Cedric Boscher 2016-06-15 16:19:37 +02:00
commit 5d7e3ce2b4
5 changed files with 70 additions and 6 deletions

View File

@ -311,8 +311,7 @@ def _time_range_match(vobject_item, filter_, child_name):
return True
elif child_name == "VJOURNAL":
dtstart = getattr(child, "dstart", None)
dtstart = getattr(child, "dtstart", None)
if dtstart is not None:
dtstart = dtstart.value
if not isinstance(dtstart, datetime):
@ -322,7 +321,6 @@ def _time_range_match(vobject_item, filter_, child_name):
.replace(tzinfo=timezone.utc))
else:
dtstart_is_datetime = True
if dtstart_is_datetime:
# Line 1
return start <= dtstart and end > dtstart

View File

@ -8,16 +8,23 @@ BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
DTSTART:19700101T000000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
DTSTART:19700101T000000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VJOURNAL
UID:journal1
DTSTAMP;TZID=Europe/Paris:19940817T000000
SUMMARY:happy new year
DESCRIPTION: Happy new year 2000 !
END:VJOURNAL
END:VCALENDAR

View File

@ -20,4 +20,12 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VJOURNAL
UID:journal2
DTSTAMP:19950817T000000
DTSTART;TZID=Europe/Paris:20000101T100000
SUMMARY:happy new year
DESCRIPTION: Happy new year 2001 !
END:VJOURNAL
END:VCALENDAR

View File

@ -20,4 +20,12 @@ RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VJOURNAL
UID:journal2
DTSTAMP:19950817T000000
DTSTART;VALUE=DATE:20000101
SUMMARY:happy new year
DESCRIPTION: Happy new year 2001 !
END:VJOURNAL
END:VCALENDAR

View File

@ -401,6 +401,49 @@ class BaseRequests:
#~ assert "href>/calendar.ics/todo7.ics</" not in answer
#~ assert "href>/calendar.ics/todo8.ics</" in answer
answer = self._test_filter(["""
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VJOURNAL">
<C:time-range start="19991229T000000Z" end="20000202T000000Z"/>
</C:comp-filter>
</C:comp-filter>"""], "journal", events=3)
assert "href>/calendar.ics/journal1.ics</" not in answer
assert "href>/calendar.ics/journal2.ics</" in answer
assert "href>/calendar.ics/journal3.ics</" in answer
answer = self._test_filter(["""
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VJOURNAL">
<C:time-range start="19981229T000000Z" end="19991012T000000Z"/>
</C:comp-filter>
</C:comp-filter>"""], "journal", events=3)
assert "href>/calendar.ics/journal1.ics</" not in answer
assert "href>/calendar.ics/journal2.ics</" not in answer
assert "href>/calendar.ics/journal3.ics</" not in answer
answer = self._test_filter(["""
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VJOURNAL">
<C:time-range start="20131229T000000Z" end="21520202T000000Z"/>
</C:comp-filter>
</C:comp-filter>"""], "journal", events=3)
assert "href>/calendar.ics/journal1.ics</" not in answer
assert "href>/calendar.ics/journal2.ics</" not in answer
assert "href>/calendar.ics/journal3.ics</" not in answer
answer = self._test_filter(["""
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VJOURNAL">
<C:time-range start="20000101T000000Z" end="20000202T000000Z"/>
</C:comp-filter>
</C:comp-filter>"""], "journal", events=3)
assert "href>/calendar.ics/journal1.ics</" not in answer
assert "href>/calendar.ics/journal2.ics</" in answer
assert "href>/calendar.ics/journal3.ics</" in answer
class TestMultiFileSystem(BaseRequests, BaseTest):
"""Base class for filesystem tests."""