コード例 #1
0
def rebuild_affiliation(aff, emails):
    """
    Combines the affiliation and the emails.
    """
    aff = unescape_csv(aff)
    emails = unescape_csv(emails)
    emails = create_email_string(emails)

    if aff and emails:
        return '%s %s' % (aff, emails)
    elif aff:
        return aff
    elif emails:
        return emails
    else:
        return ''
コード例 #2
0
def rebuild_affiliation(aff, emails):
    """
    Combines the affiliation and the emails.
    """
    aff = unescape_csv(aff)
    emails = unescape_csv(emails)
    emails = create_email_string(emails)

    if aff and emails:
        return "%s %s" % (aff, emails)
    elif aff:
        return aff
    elif emails:
        return emails
    else:
        return ""
コード例 #3
0
def create_email_string(email_field):
    if not email_field:
        return ""
    elif email_field == "[]":
        return ""
    else:
        emails = unescape_csv(email_field)
        try:
            emails = eval(emails)
        except SyntaxError:
            raise Exception("ERROR: Email field is not well formatted: '%s'." % emails)

        return "<EMAIL>%s</EMAIL>" % "</EMAIL> <EMAIL>".join(emails)
コード例 #4
0
def create_email_string(email_field):
    if not email_field:
        return ''
    elif email_field == '[]':
        return ''
    else:
        emails = unescape_csv(email_field)
        try:
            emails = eval(emails)
        except SyntaxError:
            raise Exception("ERROR: Email field is not well formatted: '%s'." % 
                    emails)

        return '<EMAIL>%s</EMAIL>' % '</EMAIL> <EMAIL>'.join(emails)