Commits

Anonymous committed faaa3c5

fixed author names

  • Participants
  • Parent commits cf915ff

Comments (0)

Files changed (2)

File moai/metadata/mods.py

 
             dai_list = []
             for contributor in contributor_data:
-                contributor_name = contributor.get('surname', [''])[0]
+                contributor_name = contributor.get('name', [''])[0]
                 unique_id = uuid.uuid4().hex
                 if unique_id[0].isdigit():
                     unique_id = '_'+unique_id
                     )
                 surname = contributor.get('surname')
                 if surname:
-                    name.append(MODS.namePart(surname[0], type="family"))
-                firstname = contributor.get('firstname')
-                if firstname:
-                    name.append(MODS.namePart(firstname[0], type="given"))
+                    surname = surname[0]
+                    prefix = contributor.get('prefix')
+                    if prefix:
+                        surname = u'%s, %s' % (surname, prefix[0])
+                    name.append(MODS.namePart(surname, type="family"))
+                initials = contributor.get('initials')
+                if initials:
+                    initials = initials[0]
+                    firstname = contributor.get('firstname')
+                    if firstname:
+                        initials = u'%s (%s)' % (initials, firstname[0])
+                    name.append(MODS.namePart(initials, type="given"))
 
                 role = contributor.get('role')
                 if role:
         if header is None:
             raise oaipmh.error.IdDoesNotExistError(identifier)
         return header, metadata, None
-
+        
     def _checkMetadataPrefix(self, metadataPrefix):
         if metadataPrefix not in self.config.metadata_prefixes:
             raise oaipmh.error.CannotDisseminateFormatError