Repository: scieloorg/articles_meta

Issue:
Tratar a exceção do tipo: TypeError  para raw.start_page
Log da produção

```
9/17/2018 8:33:21 PM    yield self.transform(data)
9/17/2018 8:33:21 PM  File "/usr/local/lib/python3.5/site-packages/articlemeta/export_rsps.py", line 1097, in transform
9/17/2018 8:33:21 PM    startpage = int(raw.start_page)
9/17/2018 8:33:21 PM TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
```

Tratar a exceção do tipo: TypeError 


Discussion:

Patch:
diff --git a/articlemeta/export_rsps.py b/articlemeta/export_rsps.py
index 6c93b1e..a64585a 100644
--- a/articlemeta/export_rsps.py
+++ b/articlemeta/export_rsps.py
@@ -1095,12 +1095,12 @@ class XMLArticleMetaCountsPipe(plumber.Pipe):
 
         try:
             startpage = int(raw.start_page)
-        except ValueError:
+        except (ValueError, TypeError):
             startpage = None
 
         try:
             endpage = int(raw.end_page)
-        except ValueError:
+        except (ValueError, TypeError):
             endpage = None
 
         pages = 0


Test patch:
diff --git a/tests/test_export_rsps.py b/tests/test_export_rsps.py
index d0a586c..b36bc6a 100644
--- a/tests/test_export_rsps.py
+++ b/tests/test_export_rsps.py
@@ -1456,6 +1456,24 @@ class ExportTests(unittest.TestCase):
 
         self.assertEqual(0, int(count))
 
+    def test_xml_article_meta_counts_pages_pages_is_none_pipe(self):
+        fakexylosearticle = Article({'article': {}})
+
+        pxml = ET.Element('article')
+        pxml.append(ET.Element('front'))
+
+        front = pxml.find('front')
+        front.append(ET.Element('article-meta'))
+
+        data = [fakexylosearticle, pxml]
+
+        xmlarticle = export_rsps.XMLArticleMetaCountsPipe()
+        raw, xml = xmlarticle.transform(data)
+
+        count = xml.find('./front/article-meta/counts/page-count').get('count')
+
+        self.assertEqual(0, int(count))
+
     def test_xml_article_meta_counts_pages_invalid_pages_first_gt_last_pipe(self):
         pxml = ET.Element('article')
         pxml.append(ET.Element('front'))