diff --git a/scielomanager/tools/import_data/journalimport.py b/scielomanager/tools/import_data/journalimport.py index 13fbc013..9c14c0be 100644 --- a/scielomanager/tools/import_data/journalimport.py +++ b/scielomanager/tools/import_data/journalimport.py @@ -25,6 +25,13 @@ from journalmanager.models import * +def capitalize(text): + + text = ' '.join([i.capitalize() for i in str(text).lower().split(' ')]) + + return text + + class JournalImport: def __init__(self): @@ -254,7 +261,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 +429,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 +447,16 @@ def load_journal(self, collection, user, loaded_sponsor, record): journal.sponsor = loaded_sponsor + if '854' in record: + for item in record['854']: + capitalized = capitalize(item) + 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 +562,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