def _get_veryfy_my_pubs_list_link_bai(person_id):
    ''' Returns canonical name links. '''
    person_link = person_id
    cid = get_person_redirect_link(person_id)

    if is_valid_canonical_id(cid):
        person_link = cid
    return person_link
def _get_veryfy_my_pubs_list_link_bai(person_id):
    ''' Returns canonical name links. '''
    person_link = person_id
    cid = get_person_redirect_link(person_id)

    if is_valid_canonical_id(cid):
        person_link = cid
    return person_link
    def __init__(self, identifier=None):
        '''
        Constructor of the web interface.

        @param identifier: identifier of an author. Can be one of:
            - an author id: e.g. "14"
            - a canonical id: e.g. "J.R.Ellis.1"
            - a bibrefrec: e.g. "100:1442,155"
        @type identifier: str
        '''
        self.person_id = -1   # -1 is a non valid author identifier
        self.cid = None
        self.original_search_parameter = identifier

        if (not CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID or
            identifier is None or
            not isinstance(identifier, str)):
            return

        # check if it's a canonical id: e.g. "J.R.Ellis.1"
        pid = int(get_person_id_from_canonical_id(identifier))
        if pid >= 0:
            self.person_id = pid
            self.cid = get_person_redirect_link(self.person_id)
            return

        # check if it's an author id: e.g. "14"
        try:
            pid = int(identifier)
            if author_has_papers(pid):
                self.person_id = pid
                cid = get_person_redirect_link(pid)
                # author may not have a canonical id
                if is_valid_canonical_id(cid):
                    self.cid = cid
                return
        except ValueError:
            pass

        # check if it's a bibrefrec: e.g. "100:1442,155"
        if is_valid_bibref(identifier):
            pid = int(get_person_id_from_paper(identifier))
            if pid >= 0:
                self.person_id = pid
                self.cid = get_person_redirect_link(self.person_id)
                return
    def __init__(self, identifier=None):
        '''
        Constructor of the web interface.

        @param identifier: identifier of an author. Can be one of:
            - an author id: e.g. "14"
            - a canonical id: e.g. "J.R.Ellis.1"
            - a bibrefrec: e.g. "100:1442,155"
        @type identifier: str
        '''
        self.person_id = -1  # -1 is a non valid author identifier
        self.cid = None
        self.original_search_parameter = identifier

        self._prepare_render_variables()

        if (not CFG_BIBAUTHORID_ENABLED or identifier is None
                or not isinstance(identifier, str)):
            return

        # check if it's a canonical id: e.g. "J.R.Ellis.1"
        pid = int(get_person_id_from_canonical_id(identifier))
        if pid >= 0:
            self.person_id = pid
            self.cid = get_person_redirect_link(self.person_id)
            return

        # check if it's an author id: e.g. "14"
        try:
            self.person_id = int(identifier)
            cid = get_person_redirect_link(pid)
            # author may not have a canonical id
            if is_valid_canonical_id(cid):
                self.cid = cid
            return
        except ValueError:
            pass

        # check if it's a bibrefrec: e.g. "100:1442,155"
        if is_valid_bibref(identifier):
            pid = int(get_person_id_from_paper(identifier))
            if pid >= 0:
                self.person_id = pid
                self.cid = get_person_redirect_link(self.person_id)
                return
    def __init__(self, person_id=None):
        """
        Constructor of the web interface.

        @param person_id: The identifier of a user. Can be one of:
            - a bibref: e.g. "100:1442,155"
            - a person id: e.g. "14"
            - a canonical id: e.g. "Ellis_J_1"
        @type person_id: string

        @return: will return an empty object if the identifier is of wrong type
        @rtype: None (if something is not right)
        """
        self.person_id = None
        self.cid = None
        self.original_search_parameter = person_id

        if not CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID:
            return

        if (not person_id) or (not isinstance(person_id, str)):
            return

        try:
            self.person_id = int(person_id)
            self.cid = get_person_redirect_link(self.person_id)
            return
        except (TypeError, ValueError):
            pass

        try:
            self.person_id = int(get_person_id_from_canonical_id(person_id))
            if self.person_id < 0:
                if is_valid_canonical_id(person_id):
                    self.cid = None
                    return
                else:
                    raise ValueError
            self.cid = get_person_redirect_link(self.person_id)
            return
        except (ValueError, TypeError):
            pass

        fail_bibrecref = False
        if person_id.count(":") and person_id.count(","):
            bibref = person_id
            table, ref, bibrec = None, None, None

            if not bibref.count(":"):
                fail_bibrecref = True

            if not bibref.count(","):
                fail_bibrecref = True

            try:
                table = bibref.split(":")[0]
                ref = bibref.split(":")[1].split(",")[0]
                bibrec = bibref.split(":")[1].split(",")[1]
            except IndexError:
                fail_bibrecref = True
            try:
                table = int(table)
                ref = int(ref)
                bibrec = int(bibrec)
            except (ValueError, TypeError):
                fail_bibrecref = True

            try:
                pid = int(get_person_id_from_paper(person_id))
            except (ValueError, TypeError):
                fail_bibrecref = True

            if not fail_bibrecref:
                self.person_id = pid
                self.cid = self.cid = get_person_redirect_link(self.person_id)
                return

        self.person_id = -1
    def __init__(self, person_id=None):
        """
        Constructor of the web interface.

        @param person_id: The identifier of a user. Can be one of:
            - a bibref: e.g. "100:1442,155"
            - a person id: e.g. "14"
            - a canonical id: e.g. "Ellis_J_1"
        @type person_id: string

        @return: will return an empty object if the identifier is of wrong type
        @rtype: None (if something is not right)
        """
        self.person_id = None
        self.cid = None
        self.original_search_parameter = person_id

        if not CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID:
            return

        if (not person_id) or (not isinstance(person_id, str)):
            return

        try:
            self.person_id = int(person_id)
            self.cid = get_person_redirect_link(self.person_id)
            return
        except (TypeError, ValueError):
            pass

        try:
            self.person_id = int(get_person_id_from_canonical_id(person_id))
            if self.person_id < 0:
                if is_valid_canonical_id(person_id):
                    self.cid = None
                    return
                else:
                    raise ValueError
            self.cid = get_person_redirect_link(self.person_id)
            return
        except (ValueError, TypeError):
            pass

        fail_bibrecref = False
        if person_id.count(":") and person_id.count(","):
            bibref = person_id
            table, ref, bibrec = None, None, None

            if not bibref.count(":"):
                fail_bibrecref = True

            if not bibref.count(","):
                fail_bibrecref = True

            try:
                table = bibref.split(":")[0]
                ref = bibref.split(":")[1].split(",")[0]
                bibrec = bibref.split(":")[1].split(",")[1]
            except IndexError:
                fail_bibrecref = True
            try:
                table = int(table)
                ref = int(ref)
                bibrec = int(bibrec)
            except (ValueError, TypeError):
                fail_bibrecref = True

            try:
                pid = int(get_person_id_from_paper(person_id))
            except (ValueError, TypeError):
                fail_bibrecref = True

            if not fail_bibrecref:
                self.person_id = pid
                self.cid = self.cid = get_person_redirect_link(self.person_id)
                return

        self.person_id = -1