Beispiel #1
0
Datei: main.py Projekt: 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
Beispiel #2
0
 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
Beispiel #3
0
Datei: views.py Projekt: IDCH/lha
 def __init__(self, request, auth_id):
     self.auth_id = auth_id
     self.request = request
     self.person = Person.get_by_id(auth_id)