def parse_vtimezone(calendar, vtimezones):
        """Receives a list of VTIMEZONE blocks.

        Parses them and adds them to calendar._timezones.
        """
        for vtimezone in vtimezones:
            remove_x(vtimezone)  # Remove non standard lines from the block
            remove_sequence(
                vtimezone
            )  # Remove SEQUENCE lines because tzical does not understand them
            fake_file = StringIO()
            fake_file.write(str(vtimezone))  # Represent the block as a string
            fake_file.seek(0)
            timezones = tzical(fake_file)  # tzical does not like strings
            # timezones is a tzical object and could contain multiple timezones
            for key in timezones.keys():
                calendar._timezones[key] = timezones.get(key)
Exemplo n.º 2
0
 def test_without_x(self):
     c = string_to_container(cal2)[0]
     c2 = string_to_container(cal2)[0]
     remove_x(c)
     self.assertSequenceEqual(c, c2)
Exemplo n.º 3
0
 def test_without_x(self):
     c = string_to_container(calendar_without_prodid)[0]
     c2 = string_to_container(calendar_without_prodid)[0]
     remove_x(c)
     self.assertSequenceEqual(c, c2)
Exemplo n.º 4
0
 def test_with_x(self):
     c = string_to_container(cal1)[0]
     remove_x(c)
     for line in c:
         self.assertFalse(line.name.startswith('X-'))
Exemplo n.º 5
0
 def test_with_x(self):
     c = string_to_container(cal1)[0]
     remove_x(c)
     for line in c:
         self.assertFalse(line.name.startswith('X-'))