Repository: scieloorg/xylose

Issue:
Incluir metodo para recuperar subtitulo do periódico v110
Incluir metodo para recuperar subtitulo do periódico v110 (subtitle)
Incluir metodo para recuperar titulo do periódico concatenado com subtitulo do periódico v110 (full_title)

Discussion:

Patch:
diff --git a/setup.py b/setup.py
index 7516cbd..d1e1950 100755
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ except ImportError:
 
 setup(
     name="xylose",
-    version='0.42',
+    version='0.43',
     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 03c2510..9b4cf43 100644
--- a/xylose/scielodocument.py
+++ b/xylose/scielodocument.py
@@ -195,10 +195,8 @@ class Journal(object):
         This method retrieves the original language of the given article.
         This method deals with the legacy fields (v400).
         """
-        if not 'v400' in self.data:
-            return None
 
-        return self.data['v400'][0]['_']
+        return self.data.get('v400', [{'_': None}])[0]['_']
 
     def url(self, language='en'):
         """
@@ -235,15 +233,6 @@ class Journal(object):
         if 'v854' in self.data:
             return [area['_'] for area in self.data['v854']]
 
-    @property
-    def abbreviated_title(self):
-        """
-        This method retrieves the journal abbreviated title of the given article, if it exists.
-        This method deals with the legacy fields (150).
-        """
-        if 'v150' in self.data:
-            return self.data['v150'][0]['_']
-
     @property
     def wos_citation_indexes(self):
         """
@@ -273,8 +262,7 @@ class Journal(object):
         This method deals with the legacy fields (480).
         """
 
-        if 'v480' in self.data:
-            return self.data['v480'][0]['_']
+        return self.data.get('v480', [{'_': None}])[0]['_']
 
     @property
     def publisher_loc(self):
@@ -284,8 +272,7 @@ class Journal(object):
         This method deals with the legacy fields (490).
         """
 
-        if 'v490' in self.data:
-            return self.data['v490'][0]['_']
+        return self.data.get('v490', [{'_': None}])[0]['_']
 
     @property
     def title(self):
@@ -295,8 +282,30 @@ class Journal(object):
         This method deals with the legacy fields (100).
         """
 
-        if 'v100' in self.data:
-            return self.data['v100'][0]['_']
+        return self.data.get('v100', [{'_': None}])[0]['_']
+
+    @property
+    def subtitle(self):
+        """
+        This method retrieves the journal subtitle.
+        This method deals with the legacy fields (v110).
+        """
+
+        return self.data.get('v110', [{'_': None}])[0]['_']
+
+    @property
+    def fulltitle(self):
+        """
+        This method retrieves the join of the journal title plus the subtitle.
+        This method deals with the legacy fields (v100, v110).
+        """
+
+        data = []
+
+        data.append(self.title)
+        data.append(self.subtitle)
+
+        return ' - '.join([i for i in data if i])
 
     @property
     def title_nlm(self):
@@ -306,8 +315,25 @@ class Journal(object):
         This method deals with the legacy fields (421).
         """
 
-        if 'v421' in self.data:
-            return self.data['v421'][0]['_']
+        return self.data.get('v421', [{'_': None}])[0]['_']
+
+    @property
+    def abbreviated_title(self):
+        """
+        This method retrieves the journal abbreviated title of the given article, if it exists.
+        This method deals with the legacy fields (150).
+        """
+
+        return self.data.get('v150', [{'_': None}])[0]['_']
+
+    @property
+    def abbreviated_iso_title(self):
+        """
+        This method retrieves the journal abbreviated title of the given article, if it exists.
+        This method deals with the legacy fields (151).
+        """
+
+        return self.data.get('v151', [{'_': None}])[0]['_']
 
     @property
     def acronym(self):
@@ -317,8 +343,7 @@ class Journal(object):
         This method deals with the legacy fields (68).
         """
 
-        if 'v68' in self.data:
-            return self.data['v68'][0]['_'].lower()
+        return self.data.get('v68', [{'_': None}])[0]['_']
 
     @property
     def periodicity(self):
@@ -401,6 +426,7 @@ class Journal(object):
 
         return tools.get_date(self.data['v941'][0]['_'])
 
+
 class Article(object):
 
     def __init__(self, data, iso_format=None):


Test patch:
diff --git a/tests/test_document.py b/tests/test_document.py
index 6ade9eb..7405ad9 100644
--- a/tests/test_document.py
+++ b/tests/test_document.py
@@ -623,11 +623,47 @@ class JournalTests(unittest.TestCase):
 
     def test_journal_title_nlm(self):
         self.fulldoc['title']['v421'] = [{u'_': u'Acta Limnologica Brasiliensia NLM'}]
-        
+
         journal = Journal(self.fulldoc['title'])
 
         self.assertEqual(journal.title_nlm, u'Acta Limnologica Brasiliensia NLM')
 
+    def test_journal_fulltitle(self):
+        self.fulldoc['title']['v100'] = [{u'_': u'Title'}]
+        self.fulldoc['title']['v110'] = [{u'_': u'SubTitle'}]
+
+        journal = Journal(self.fulldoc['title'])
+
+        self.assertEqual(journal.fulltitle, u'Title - SubTitle')
+
+    def test_journal_fulltitle_without_title(self):
+        del(self.fulldoc['title']['v100'])
+        self.fulldoc['title']['v110'] = [{u'_': u'SubTitle'}]
+
+        journal = Journal(self.fulldoc['title'])
+
+        self.assertEqual(journal.fulltitle, u'SubTitle')
+
+    def test_journal_fulltitle_without_subtitle(self):
+        self.fulldoc['title']['v100'] = [{u'_': u'Title'}]
+
+        journal = Journal(self.fulldoc['title'])
+
+        self.assertEqual(journal.fulltitle, u'Title')
+
+    def test_journal_subtitle(self):
+        self.fulldoc['title']['v110'] = [{u'_': u'SubTitle'}]
+
+        journal = Journal(self.fulldoc['title'])
+
+        self.assertEqual(journal.subtitle, u'SubTitle')
+
+    def test_journal_without_subtitle(self):
+
+        journal = Journal(self.fulldoc['title'])
+
+        self.assertEqual(journal.subtitle, None)
+
     def test_without_journal_title_nlm(self):
         journal = self.journal