From 62ef30ff42f184d5128655b7648396bb8ce32894 Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Wed, 4 Jun 2014 15:22:56 -0300 Subject: [PATCH 1/4] =?UTF-8?q?Incluindo=20carga=20de=20=C3=A1reas=20do=20?= =?UTF-8?q?WoS=20e=20bases=20do=20WoS=20onde=20o=20peri=C3=B3dico=20=C3=A9?= =?UTF-8?q?=20indexado,=20#819?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/import_data/journalimport.py | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/scielomanager/tools/import_data/journalimport.py b/scielomanager/tools/import_data/journalimport.py index 13fbc013..2aa46052 100644 --- a/scielomanager/tools/import_data/journalimport.py +++ b/scielomanager/tools/import_data/journalimport.py @@ -25,6 +25,11 @@ from journalmanager.models import * +def capitalize(text): + text = str(text).lower() + return text[0].upper()+text[1:] + + class JournalImport: def __init__(self): @@ -254,7 +259,7 @@ def load_use_license(self, code, disclaimer): use_license = UseLicense.objects.get_or_create(license_code=code)[0] - if parsed_subfields_disclaimer.has_key('t'): + if 't' in parsed_subfields_disclaimer: use_license.disclaimer = parsed_subfields_disclaimer['t'] use_license.save() @@ -422,6 +427,15 @@ def load_journal(self, collection, user, loaded_sponsor, record): if '64' in record: journal.editor_email = record['64'][0] + if '851' in record: + journal.is_indexed_scie = True + + if '852' in record: + journal.is_indexed_ssci = True + + if '853' in record: + journal.is_indexed_aehci = True + journal.creator_id = user.pk journal.collection = collection @@ -431,6 +445,16 @@ def load_journal(self, collection, user, loaded_sponsor, record): journal.sponsor = loaded_sponsor + if '854' in record: + for item in record['854']: + capitalized = ' '.join([capitalize(i.lower()) for i in item.split(' ')]) + try: + area = SubjectCategory.objects.get(term=capitalized) + except: + print 'Subject Category not found (%s) for journal (%s)' % (capitalized, journal.title) + + journal.subject_categories.add(area) + # created date if '940' in record: journal.created = self.iso_format(record['940'][0]) @@ -536,4 +560,4 @@ def get_conflicted_journals(self): """ Retorna a lista de revistas que já fazem parte do SciELO Manager e não puderam ser importadas. """ - return self._conflicted_journals \ No newline at end of file + return self._conflicted_journals From a1b0cd1ef670984bd75a0dc742af9eaccf7de79b Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Wed, 4 Jun 2014 15:26:30 -0300 Subject: [PATCH 2/4] =?UTF-8?q?Incluindo=20carga=20de=20=C3=A1reas=20do=20?= =?UTF-8?q?WoS=20e=20bases=20do=20WoS=20onde=20o=20peri=C3=B3dico=20=C3=A9?= =?UTF-8?q?=20indexado,=20#819?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scielomanager/tools/import_data/journalimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scielomanager/tools/import_data/journalimport.py b/scielomanager/tools/import_data/journalimport.py index 2aa46052..9db0e2db 100644 --- a/scielomanager/tools/import_data/journalimport.py +++ b/scielomanager/tools/import_data/journalimport.py @@ -447,7 +447,7 @@ def load_journal(self, collection, user, loaded_sponsor, record): if '854' in record: for item in record['854']: - capitalized = ' '.join([capitalize(i.lower()) for i in item.split(' ')]) + capitalized = ' '.join([capitalize(i) for i in item.split(' ')]) try: area = SubjectCategory.objects.get(term=capitalized) except: From 04db6ed81176cad0d3aa6f5011eeba72f1fefc95 Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Wed, 4 Jun 2014 15:44:59 -0300 Subject: [PATCH 3/4] =?UTF-8?q?Incluindo=20carga=20de=20=C3=A1reas=20do=20?= =?UTF-8?q?WoS=20e=20bases=20do=20WoS=20onde=20o=20peri=C3=B3dico=20=C3=A9?= =?UTF-8?q?=20indexado,=20#819?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scielomanager/tools/import_data/journalimport.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scielomanager/tools/import_data/journalimport.py b/scielomanager/tools/import_data/journalimport.py index 9db0e2db..3cde57dd 100644 --- a/scielomanager/tools/import_data/journalimport.py +++ b/scielomanager/tools/import_data/journalimport.py @@ -26,8 +26,13 @@ def capitalize(text): - text = str(text).lower() - return text[0].upper()+text[1:] + + def capitalize_word(word): + return word[0].upper()+word[1:] + + text = ' '.join([capitalize_word(i) for i in str(text).lower().split(' ')]) + + return text class JournalImport: @@ -447,7 +452,7 @@ def load_journal(self, collection, user, loaded_sponsor, record): if '854' in record: for item in record['854']: - capitalized = ' '.join([capitalize(i) for i in item.split(' ')]) + capitalized = capitalize(item) try: area = SubjectCategory.objects.get(term=capitalized) except: From cd4bf312b95998205be40ad5ec3bd18a45403727 Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Mon, 9 Jun 2014 15:50:20 -0300 Subject: [PATCH 4/4] utilizando o metodo capitalize buit-in do objeto str --- scielomanager/tools/import_data/journalimport.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scielomanager/tools/import_data/journalimport.py b/scielomanager/tools/import_data/journalimport.py index 3cde57dd..9c14c0be 100644 --- a/scielomanager/tools/import_data/journalimport.py +++ b/scielomanager/tools/import_data/journalimport.py @@ -27,10 +27,7 @@ def capitalize(text): - def capitalize_word(word): - return word[0].upper()+word[1:] - - text = ' '.join([capitalize_word(i) for i in str(text).lower().split(' ')]) + text = ' '.join([i.capitalize() for i in str(text).lower().split(' ')]) return text