Repository: collective/icalendar

Issue:
incompatible changes in 3.9.2
With 70a7b5a16748afbf0d48ca180c2b7613fdd7e7d0 we introduced some  backwards incompatible changes:

 * `Component.is_broken` got replaced with `Component.errors`
 * events with a `RDATE;VALUE=PERIOD:19970101T180000Z/19970102T070000Z,19970109T180000Z/PT5H30M` component still had an `RDATE` with `VALUE=PERIOD` param before, now they are `RDATE:None`

While I do agree with both changes, I think they should have been deferred to the 4.0.0 release. Because we don't have `VALUE=PERIOD` anyway I think we can leave this one as it is, but I believe we should bring back `Component.is_broken` for the 3.9.3 release.


Discussion:
untitaker: Could be a property that checks bool value of `self.errors`.
stlaz: I would rather like to see it a property dependant on self.errors, too.
You could do something like:
~~~python
class Component:
    @property
    def is_broken(self):
        return bool(self.errors)
~~~

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 5fbf217..405ebcb 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,6 +11,7 @@ New:
 Fixes:
 
 - Fix testsuite for use with ``dateutil>=2.5``. Refs #195.
+- Reintroduce cal.Component.is_broken that was removed with 3.9.2 [geier]
 
 
 3.9.2 (2016-02-05)
diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py
index 9828c54..8448dba 100644
--- a/src/icalendar/cal.py
+++ b/src/icalendar/cal.py
@@ -106,6 +106,10 @@ class Component(CaselessDict):
         """
         return True if not (list(self.values()) + self.subcomponents) else False  # noqa
 
+    @property
+    def is_broken(self):
+        return bool(self.errors)
+
     #############################
     # handling of property values
 


Test patch:
diff --git a/src/icalendar/tests/test_fixed_issues.py b/src/icalendar/tests/test_fixed_issues.py
index ae29535..6b375d3 100644
--- a/src/icalendar/tests/test_fixed_issues.py
+++ b/src/icalendar/tests/test_fixed_issues.py
@@ -200,6 +200,7 @@ X
 END:VEVENT"""
         event = icalendar.Calendar.from_ical(ical_str)
         self.assertTrue(isinstance(event, icalendar.Event))
+        self.assertTrue(event.is_broken)  # REMOVE FOR NEXT MAJOR RELEASE
         self.assertEqual(
             event.errors,
             [(None, "Content line could not be parsed into parts: 'X': Invalid content line")]  # noqa