Commits

Lennart Regebro committed 238b9eb

Issue #11: pyroma would fail if long_description was a non-string.

Comments (0)

Files changed (2)

 1.4 (unreleased)
 ----------------
 
+- Issue #11: pyroma would fail if long_description was a non-string.
+  
 - zest.releaser now only runs Pyroma on Python packages.
-  [maurits]
+
 
 
 1.3 (2013-03-15)

pyroma/ratings.py

 from docutils.core import publish_parts
 from docutils.utils import SystemMessage
 
+try:
+    stringtypes = basestring,
+except NameError:
+    stringtypes = str,
+
 LEVELS = ["This cheese seems to contain no dairy products",
           "Vieux Bologne",
           "Limburger",
     weight = 50
     
     def test(self, data):
-        return len(data.get('long_description', '')) > 100
+        long_description = data.get('long_description', '')
+        if not isinstance(long_description, stringtypes):
+            long_description = ''
+        return len(long_description) > 100
     
     def message(self):
         return 'The packages long_description is quite short.'