Exemple #1
0
 def validate(self):
     """Verify that file contents are valid."""
     cal = self.calendar
     # TODO(jelmer): return the list of errors to the caller
     if cal.is_broken:
         raise InvalidFileContents(self.content_type, self.content)
     if list(validate_calendar(cal, strict=False)):
         raise InvalidFileContents(self.content_type, self.content)
Exemple #2
0
 def calendar(self):
     if self._calendar is None:
         try:
             self._calendar = Calendar.from_ical(b''.join(self.content))
         except ValueError:
             raise InvalidFileContents(self.content_type, self.content)
     return self._calendar