Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject all daily events in import #3432

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions integreat_cms/cms/utils/external_calendar_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,14 @@ def from_ical_event(

recurrence_rule = None
if "RRULE" in event:
if (
event.decoded("RRULE")["FREQ"] == ["DAILY"]
and event.decoded("RRULE")["UNTIL"]
):
if start_date == end_date:
end_date = event.decoded("RRULE")["UNTIL"][0]
else:
pass
else:
end_date = start_date
recurrence_rule = RecurrenceRuleData.from_ical_rrule(
recurrence_rule=event.decoded("RRULE"),
start=start_date,
logger=logger,
)
if event.decoded("RRULE")["FREQ"] == ["DAILY"]:
raise ValueError("Daily events are not allowed anymore.")
end_date = start_date
recurrence_rule = RecurrenceRuleData.from_ical_rrule(
recurrence_rule=event.decoded("RRULE"),
start=start_date,
logger=logger,
)

return cls(
event_id=event_id,
Expand Down
2 changes: 1 addition & 1 deletion tests/core/management/commands/test_import_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,4 @@ def test_daily_event_not_imported(httpserver: HTTPServer, load_test_data: None)
).exists(), "The recurrence rule should not exist"
assert not calendar.events.exists(), "The event should not exist"

assert "Could not import event because it does not have a required field: " in err
assert "Could not import event" in err
Loading