Example #1
0
File: main.py Project: IDCH/lha
def get_or_create_person(authorname, app):
    """ Retrieves the person object that represents the author of this document
        or creates a new person if no person with this name exists.

        NOTE that this does not yet enable disambiguation of multiple people 
        with the same name.
    """
    (last, first) = Person.parse(authorname)
    people = Person.get(last, first)
    if people:
        person = people[0]
        app.log.debug("Retrieved author (%s)..." % (person))
    else:
        app.log.info("Creating author (%s)..." % (authorname))
        person = Person.create(authorname)

    return person
Example #2
0
File: importer.py Project: IDCH/lha
 def _create_author(self, document, authorname, role="Author"):
     if not authorname:
         return None
     
     (last, first) = Person.parse(authorname)
     people = Person.get(last, first)
     if people:
         person = people[0]
     else:
         print("    Creating author (%s)..." % (authorname))
         person = Person.create(authorname)
     
     if role == "tr":
         role = "Translator"
     elif role == "ed":
         role = "Editor"
     elif not role:
         role = "Author"
     
     author = document.add_author(person, role)
     return author
Example #3
0
File: views.py Project: IDCH/lha
 def __init__(self, request, auth_id):
     self.auth_id = auth_id
     self.request = request
     self.person = Person.get_by_id(auth_id)