-
-
Notifications
You must be signed in to change notification settings - Fork 178
Open
Description
Some properties are required, others optional, some are strictly typed.
In order to start creating valid calendar times with many other features included, this issue proposes adding a new()
method to the Component
classes.
Example:
>>> event = Event.new(start=date(2025, 10, 11))
>>> print(event.to_ical().decode())
BEGIN:VEVENT
DTSTART;VALUE=DATE:20251011
UID:<randomly-generated-uuid4>
DTSTAMP:<now>
END:VEVENT
>>> calendar = Calendar.new(components=[event])
Benefits:
- The calendar can create a valid calendar from the start
- E.g. DTSTART is required IF the calendar has no method -> we can run checks on the whole object structure
- We can use getters and setters to set the values, providing additional verification without code duplication
- Generation and setting of default values is still possible
- We do not deprecate or interfere with the minimal way of
event = Event()
See also:
- Mandatory properties are neither enforced nor set to a default #596
- unique identifier must be included in VEVENT, VTODO, and VJOURNAL #315
- Enhancing icalendar through attributes #662
- (Auto) fixing invalid icalendar (components) #536
- Strict mode for reading/writing ical #548
- Guide the creation of rfc compatible components #817
Metadata
Metadata
Assignees
Labels
No labels