Esempio n. 1
0
 def unwrap_rrule(self):
     # Unwraps the RRULE list of strings into RecurringEvent properties.
     for item in self.recurring:
         if item.startswith('RRULE'):
             self.rrule = item
             if 'UNTIL' in item:
                 for p in item.split(';'):
                     if p.startswith('UNTIL'):
                         self.until = parse_rrule_datetime(p[6:])
         elif item.startswith('EXDATE'):
             self.exdate = item
Esempio n. 2
0
    def unwrap_rrule(self):
        from inbox.events.util import parse_rrule_datetime

        # Unwraps the RRULE list of strings into RecurringEvent properties.
        for item in self.recurring:
            if item.startswith("RRULE"):
                self.rrule = item
                if "UNTIL" in item:
                    for p in item.split(";"):
                        if p.startswith("UNTIL"):
                            self.until = parse_rrule_datetime(p[6:])
            elif item.startswith("EXDATE"):
                self.exdate = item
Esempio n. 3
0
def parse_exdate(event):
    # Parse the EXDATE string and return a list of arrow datetimes
    excl_dates = []
    if event.exdate:
        name, values = event.exdate.split(':', 1)
        tzinfo = 'UTC'
        for p in name.split(';'):
            # Handle TZID in EXDATE (TODO: submit PR to python-dateutil)
            if p.startswith('TZID'):
                tzinfo = p[5:]
        for v in values.split(','):
            # convert to timezone-aware dates
            t = parse_rrule_datetime(v, tzinfo)
            excl_dates.append(t)
    return excl_dates
Esempio n. 4
0
def parse_exdate(event):
    # Parse the EXDATE string and return a list of arrow datetimes
    excl_dates = []
    if event.exdate:
        name, values = event.exdate.split(":", 1)
        tzinfo = "UTC"
        for p in name.split(";"):
            # Handle TZID in EXDATE (TODO: submit PR to python-dateutil)
            if p.startswith("TZID"):
                tzinfo = p[5:]
        for v in values.split(","):
            # convert to timezone-aware dates
            t = parse_rrule_datetime(v, tzinfo)
            excl_dates.append(t)
    return excl_dates