Repository: scieloorg/xylose

Issue:
Outra forma de persistir páginas.
Nova forma encontrada de persistir páginas no SciELO.

```
v14: [
{
_: "23-32"
}
]
```

Discussion:

Patch:
diff --git a/setup.py b/setup.py
index 09e541f..e3f1883 100755
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ except ImportError:
 
 setup(
     name="xylose",
-    version='0.7b',
+    version='0.8b',
     description="A SciELO library to abstract a JSON data structure that is a product of the ISIS2JSON conversion using the ISIS2JSON type 3 data model.",
     author="SciELO",
     author_email="scielo-dev@googlegroups.com",
diff --git a/xylose/scielodocument.py b/xylose/scielodocument.py
index a16ee47..39d94e3 100644
--- a/xylose/scielodocument.py
+++ b/xylose/scielodocument.py
@@ -792,6 +792,12 @@ class Article(object):
                 if 'f' in item:
                     return item['f']
 
+            # if nothing works until now. we will try once more. It's tested.
+
+            pages = sorted(self.data['article']['v14'][0]['_'].split('-'))
+
+            return pages[0] or None
+
     @property
     def end_page(self):
         """
@@ -803,6 +809,12 @@ class Article(object):
                 if 'l' in item:
                     return item['l']
 
+            # if nothing works until now. we will try once more. It's tested.
+
+            pages = sorted(self.data['article']['v14'][0]['_'].split('-'))
+
+            return pages[-1] or None
+
     @property
     def doi(self):
         """


Test patch:
diff --git a/tests/test_document.py b/tests/test_document.py
index 71a7da4..a409140 100644
--- a/tests/test_document.py
+++ b/tests/test_document.py
@@ -972,6 +972,28 @@ class ArticleTests(unittest.TestCase):
 
         self.assertEqual(article.start_page, u'110')
 
+    def test_start_page_loaded_crazy_legacy_way_1(self):
+        article = self.article
+
+        article.data['article']['v14'] = [
+            {
+                u'_': u'110-122',
+            }
+        ]
+
+        self.assertEqual(article.start_page, u'110')
+
+    def test_start_page_loaded_crazy_legacy_way_2(self):
+        article = self.article
+
+        article.data['article']['v14'] = [
+            {
+                u'_': u'122-110',
+            }
+        ]
+
+        self.assertEqual(article.start_page, u'110')
+
     def test_last_page(self):
         article = self.article
 
@@ -999,6 +1021,27 @@ class ArticleTests(unittest.TestCase):
 
         self.assertEqual(article.end_page, u'122')
 
+    def test_end_page_loaded_crazy_legacy_way_1(self):
+        article = self.article
+
+        article.data['article']['v14'] = [
+            {
+                u'_': u'110-122',
+            }
+        ]
+
+        self.assertEqual(article.end_page, u'122')
+
+    def test_end_page_loaded_crazy_legacy_way_2(self):
+        article = self.article
+
+        article.data['article']['v14'] = [
+            {
+                u'_': u'122-110',
+            }
+        ]
+
+        self.assertEqual(article.end_page, u'122')
 
     def test_without_pages(self):
         article = self.article