Exemplo n.º 1
0
    def serialize_dtstamp(todo: "Todo", container: Container):
        if todo.dtstamp:
            instant = todo.dtstamp
        else:
            instant = arrow.now()

        container.append(ContentLine("DTSTAMP", value=arrow_to_iso(instant)))
    def serialize_trigger(alarm, container):
        if not alarm.trigger:
            raise ValueError("Alarm must have a trigger")

        if isinstance(alarm.trigger, timedelta):
            representation = timedelta_to_duration(alarm.trigger)
            container.append(ContentLine("TRIGGER", value=representation))
        else:
            container.append(
                ContentLine(
                    "TRIGGER",
                    params={"VALUE": ["DATE-TIME"]},
                    value=arrow_to_iso(alarm.trigger),
                ))
Exemplo n.º 3
0
 def serialize_dtstamp(event, container):
     container.append(ContentLine("DTSTAMP", value=arrow_to_iso(now)))
Exemplo n.º 4
0
 def serialize_created(event, container):
     if event.created:
         container.append(
             ContentLine("CREATED", value=arrow_to_iso(event.created)))
Exemplo n.º 5
0
 def serialize_due(todo: "Todo", container: Container):
     if todo._due_time:
         container.append(ContentLine("DUE", value=arrow_to_iso(todo._due_time)))
Exemplo n.º 6
0
 def serialize_start(todo: "Todo", container: Container):
     if todo.begin:
         container.append(ContentLine("DTSTART", value=arrow_to_iso(todo.begin)))
Exemplo n.º 7
0
 def serialize_created(todo: "Todo", container: Container):
     if todo.created:
         container.append(ContentLine("CREATED", value=arrow_to_iso(todo.created)))
Exemplo n.º 8
0
 def serialize_completed(todo: "Todo", container: Container):
     if todo.completed:
         container.append(
             ContentLine("COMPLETED", value=arrow_to_iso(todo.completed))
         )
Exemplo n.º 9
0
 def serialize_end(event, container):
     if event.begin and event._end_time and not event.all_day:
         container.append(
             ContentLine("DTEND", value=arrow_to_iso(event.end)))
Exemplo n.º 10
0
 def serialize_start(event, container):
     if event.begin and not event.all_day:
         container.append(
             ContentLine("DTSTART", value=arrow_to_iso(event.begin)))
Exemplo n.º 11
0
 def serialize_last_modified(event, container):
     if event.last_modified:
         instant = event.last_modified
         container.append(
             ContentLine("LAST-MODIFIED", value=arrow_to_iso(instant)))