def create_authorpage_citations(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                summarize_records, summarize_recordsStatus = get_summarize_records(
                    person_id)
                if not summarize_records:
                    summarize_records = 'None'

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                json_response['boxes_info'].update({
                    'citations': {
                        'status': (summarize_recordsStatus and pubsStatus),
                        'html_content':
                        webauthorprofile_templates.tmpl_citations_box(
                            summarize_records,
                            pubs,
                            ln='en',
                            add_box=False,
                            loading=not (summarize_recordsStatus
                                         and pubsStatus))
                    }
                })
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_authors_pubs(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                namesdict, namesdictStatus = get_person_names_dicts(person_id)
                if not namesdict:
                    namesdict = dict()
                try:
                    authorname = namesdict['longest']
                except (IndexError, KeyError):
                    authorname = 'None'

                person_link, person_linkStatus = get_veryfy_my_pubs_list_link(person_id)
                bibauthorid_data = {'is_baid': True, 'pid': person_id, 'cid': person_link}
                if not person_link or not person_linkStatus:
                    bibauthorid_data = {'is_baid': True, 'pid': person_id, 'cid': None}
                    person_link = str(person_id)

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                json_response['boxes_info'].update({'authornametitle': {'status': (namesdictStatus and namesdictStatus and pubsStatus), 'html_content': webauthorprofile_templates.tmpl_authornametitle(authorname, bibauthorid_data, pubs, person_link, ln='en', loading=not (namesdictStatus and namesdictStatus and pubsStatus))}})
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_combined_papers(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                selfpubs, selfpubsStatus = get_self_pubs(person_id)
                if not selfpubs:
                    selfpubs = list()

                person_link, person_linkStatus = get_veryfy_my_pubs_list_link(person_id)
                bibauthorid_data = {'is_baid': True, 'pid': person_id, 'cid': None}
                if person_link and person_linkStatus:
                    bibauthorid_data = {'is_baid': True, 'pid': person_id, 'cid': person_link}

                totaldownloads, totaldownloadsStatus = get_total_downloads(person_id)
                if not totaldownloads:
                    totaldownloads = 0

                json_response['boxes_info'].update({'combined_papers': {'status': selfpubsStatus, 'html_content': webauthorprofile_templates.tmpl_papers_with_self_papers_box(pubs, selfpubs, bibauthorid_data, totaldownloads, ln='en', add_box=False, loading=not selfpubsStatus)}})
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_citations(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                summarize_records, summarize_recordsStatus = get_summarize_records(
                    person_id)
                if not summarize_records:
                    summarize_records = 'None'

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                json_response['boxes_info'].update({
                    'citations': {
                        'status': (summarize_recordsStatus and pubsStatus),
                        'html_content':
                        webauthorprofile_templates.tmpl_citations_box(
                            summarize_records,
                            pubs,
                            ln='en',
                            add_box=False,
                            loading=not (summarize_recordsStatus
                                         and pubsStatus))
                    }
                })
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_combined_papers(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                selfpubs, selfpubsStatus = get_self_pubs(person_id)
                if not selfpubs:
                    selfpubs = list()

                person_link, person_linkStatus = get_veryfy_my_pubs_list_link(
                    person_id)
                bibauthorid_data = {
                    'is_baid': True,
                    'pid': person_id,
                    'cid': None
                }
                if person_link and person_linkStatus:
                    bibauthorid_data = {
                        'is_baid': True,
                        'pid': person_id,
                        'cid': person_link
                    }

                totaldownloads, totaldownloadsStatus = get_total_downloads(
                    person_id)
                if not totaldownloads:
                    totaldownloads = 0

                json_response['boxes_info'].update({
                    'combined_papers': {
                        'status':
                        selfpubsStatus,
                        'html_content':
                        webauthorprofile_templates.
                        tmpl_papers_with_self_papers_box(
                            pubs,
                            selfpubs,
                            bibauthorid_data,
                            totaldownloads,
                            ln='en',
                            add_box=False,
                            loading=not selfpubsStatus)
                    }
                })
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_authors_pubs(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                namesdict, namesdictStatus = get_person_names_dicts(person_id)
                if not namesdict:
                    namesdict = dict()
                try:
                    authorname = namesdict['longest']
                except (IndexError, KeyError):
                    authorname = 'None'

                person_link, person_linkStatus = get_veryfy_my_pubs_list_link(
                    person_id)
                bibauthorid_data = {
                    'is_baid': True,
                    'pid': person_id,
                    'cid': person_link
                }
                if not person_link or not person_linkStatus:
                    bibauthorid_data = {
                        'is_baid': True,
                        'pid': person_id,
                        'cid': None
                    }
                    person_link = str(person_id)

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                json_response['boxes_info'].update({
                    'authornametitle': {
                        'status': (namesdictStatus and namesdictStatus
                                   and pubsStatus),
                        'html_content':
                        webauthorprofile_templates.tmpl_authornametitle(
                            authorname,
                            bibauthorid_data,
                            pubs,
                            person_link,
                            ln='en',
                            loading=not (namesdictStatus and namesdictStatus
                                         and pubsStatus))
                    }
                })
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_citations(self, req, form):
        if 'jsondata' in form:
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)

            if 'personId' in json_data:
                person_id = json_data['personId']

                citation_data, cache_status = get_summarize_records(person_id)
                records, records_cache_status = get_pubs(person_id)
                datasets = get_datasets(person_id)
                if datasets and datasets[0]:
                    datasets = len(datasets[0])
                else:
                    datasets = 0

                citations = {
                    'breakdown_categories': [
                        'Renowned papers (500+)', 'Famous papers (250-499)',
                        'Very well-known papers (100-249)',
                        'Well-known papers (50-99)', 'Known papers (10-49)',
                        'Less known papers (1-9)', 'Unknown papers (0)'
                    ]
                }

                content = "Data not ready. Please wait..."
                if cache_status and citation_data and records and records_cache_status:
                    citations['papers_num'] = len(records)
                    try:
                        citations['papers'], citations['data'] = citation_data[
                            0]
                    except IndexError:
                        pass

                    result = get_canonical_name_of_author(person_id)
                    if result:
                        canonical_name = result[0][0]
                    else:
                        canonical_name = ""
                    content = WebProfilePage.render_citations_summary_content(
                        citations, canonical_name, datasets)
                elif not citation_data and not records:
                    content = "No citations data."

                json_response = {
                    'status': (cache_status and records_cache_status),
                    'html': content
                }

                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_pubs(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                person_link, person_linkStatus = get_veryfy_my_pubs_list_link(person_id)
                bibauthorid_data = {'is_baid': True, 'pid': person_id, 'cid': None}
                if person_link and person_linkStatus:
                    bibauthorid_data = {'is_baid': True, 'pid': person_id, 'cid': person_link}

                json_response['boxes_info'].update({'numpaperstitle': {'status': pubsStatus, 'html_content': webauthorprofile_templates.tmpl_numpaperstitle(bibauthorid_data, pubs)}})
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_pubs(self, req, form):
        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            if json_data.has_key('personId'):
                person_id = json_data['personId']

                pubs, pubsStatus = get_pubs(person_id)
                if not pubs:
                    pubs = list()

                person_link, person_linkStatus = get_veryfy_my_pubs_list_link(
                    person_id)
                bibauthorid_data = {
                    'is_baid': True,
                    'pid': person_id,
                    'cid': None
                }
                if person_link and person_linkStatus:
                    bibauthorid_data = {
                        'is_baid': True,
                        'pid': person_id,
                        'cid': person_link
                    }

                json_response['boxes_info'].update({
                    'numpaperstitle': {
                        'status':
                        pubsStatus,
                        'html_content':
                        webauthorprofile_templates.tmpl_numpaperstitle(
                            bibauthorid_data, pubs)
                    }
                })
                req.content_type = 'application/json'
                return json.dumps(json_response)
    def create_authorpage_websearch(self, req, form, person_id, ln='en', expire_cache=False):

        recompute_allowed = True

        oldest_cache_date = get_person_oldest_date(person_id)
        if oldest_cache_date:
            delay = datetime.datetime.now() - oldest_cache_date
            if delay > RECOMPUTE_ALLOWED_DELAY:
                if expire_cache:
                    recompute_allowed = False
                    expire_all_cache_for_person(person_id)
            else:
                recompute_allowed = False

        if CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID:
            if person_id < 0:
                return ("Critical Error. PersonID should never be less than 0!")

        pubs, pubsStatus = get_pubs(person_id)
        if not pubs:
            pubs = []

        selfpubs, selfpubsStatus = get_self_pubs(person_id)
        if not selfpubs:
            selfpubs = []

        namesdict, namesdictStatus = get_person_names_dicts(person_id)
        if not namesdict:
            namesdict = {}

        try:
            authorname = namesdict['longest']
            db_names_dict = namesdict['db_names_dict']
        except (IndexError, KeyError):
            authorname = 'None'
            db_names_dict = {}

        #author_aff_pubs, author_aff_pubsStatus = (None, None)
        author_aff_pubs, author_aff_pubsStatus = get_institute_pub_dict(person_id)
        if not author_aff_pubs:
            author_aff_pubs = {}


        coauthors, coauthorsStatus = get_coauthors(person_id)
        if not coauthors:
            coauthors = {}

        summarize_records, summarize_recordsStatus = get_summarize_records(person_id, 'hcs', ln)
        if not summarize_records:
            summarize_records = 'None'

        totaldownloads, totaldownloadsStatus = get_total_downloads(person_id)
        if not totaldownloads:
            totaldownloads = 0

        citedbylist, citedbylistStatus = get_cited_by_list(person_id)
        if not citedbylist:
            citedbylist = 'None'

        kwtuples, kwtuplesStatus = get_kwtuples(person_id)
        if kwtuples:
            pass
            #kwtuples = kwtuples[0:MAX_KEYWORD_LIST]
        else:
            kwtuples = []

        collab, collabStatus = get_collabtuples(person_id)

        vtuples, venuetuplesStatus = get_venuetuples(person_id)
        if vtuples:
            pass
            #vtuples = venuetuples[0:MAX_VENUE_LIST]
        else:
            vtuples = str(vtuples)

        person_link, person_linkStatus = get_veryfy_my_pubs_list_link(person_id)
        if not person_link or not person_linkStatus:
            bibauthorid_data = {"is_baid": True, "pid":person_id, "cid": None}
            person_link = str(person_id)
        else:
            bibauthorid_data = {"is_baid": True, "pid":person_id, "cid": person_link}

        hepdict, hepdictStatus = get_hepnames_data(person_id)

        oldest_cache_date = get_person_oldest_date(person_id)

        #req.write("\nPAGE CONTENT START\n")
        #req.write(str(time.time()))
        #eval = [not_empty(x) or y for x, y in
        beval = [y for _, y in
                                               [(authorname, namesdictStatus) ,
                                               (totaldownloads, totaldownloadsStatus),
                                               (author_aff_pubs, author_aff_pubsStatus),
                                               (citedbylist, citedbylistStatus),
                                               (kwtuples, kwtuplesStatus),
                                               (coauthors, coauthorsStatus),
                                               (vtuples, venuetuplesStatus),
                                               (db_names_dict, namesdictStatus),
                                               (person_link, person_linkStatus),
                                               (summarize_records, summarize_recordsStatus),
                                               (pubs, pubsStatus),
                                               (hepdict, hepdictStatus),
                                               (selfpubs, selfpubsStatus),
                                               (collab, collabStatus)]]
        #not_complete = False in eval
        #req.write(str(eval))

        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            # loop to check which boxes need content
            json_response['boxes_info'].update({'name_variants': {'status':beval[0], 'html_content': webauthorprofile_templates.tmpl_author_name_variants_box(req, db_names_dict, bibauthorid_data, ln, add_box=False, loading=not beval[0])}})
            json_response['boxes_info'].update({'combined_papers': {'status':(beval[3] and beval[12]), 'html_content': webauthorprofile_templates.tmpl_papers_with_self_papers_box(req, pubs, selfpubs, bibauthorid_data, totaldownloads, ln, add_box=False, loading=not beval[3])}})
            #json_response['boxes_info'].update({'papers': {'status':beval[3], 'html_content': webauthorprofile_templates.tmpl_papers_box(req, pubs, bibauthorid_data, totaldownloads, ln, add_box=False, loading=not beval[3])}})
            json_response['boxes_info'].update({'selfpapers': {'status':beval[12], 'html_content': webauthorprofile_templates.tmpl_self_papers_box(req, selfpubs, bibauthorid_data, totaldownloads, ln, add_box=False, loading=not beval[12])}})
            json_response['boxes_info'].update({'keywords': {'status':beval[4], 'html_content': webauthorprofile_templates.tmpl_keyword_box(kwtuples, bibauthorid_data, ln, add_box=False, loading=not beval[4])}})
            json_response['boxes_info'].update({'affiliations': {'status':beval[2], 'html_content': webauthorprofile_templates.tmpl_affiliations_box(author_aff_pubs, ln, add_box=False, loading=not beval[2])}})
            json_response['boxes_info'].update({'coauthors': {'status':beval[5], 'html_content': webauthorprofile_templates.tmpl_coauthor_box(bibauthorid_data, coauthors, ln, add_box=False, loading=not beval[5])}})
            json_response['boxes_info'].update({'numpaperstitle': {'status':beval[10], 'html_content': webauthorprofile_templates.tmpl_numpaperstitle(bibauthorid_data, pubs)}})
            json_response['boxes_info'].update({'authornametitle': {'status':beval[7], 'html_content': webauthorprofile_templates.tmpl_authornametitle(db_names_dict)}})
            json_response['boxes_info'].update({'citations': {'status':beval[9], 'html_content': summarize_records}})
            json_response['boxes_info'].update({'hepdata': {'status':beval[11], 'html_content':webauthorprofile_templates.tmpl_hepnames(hepdict, ln, add_box=False, loading=not beval[11])}})
            json_response['boxes_info'].update({'collaborations': {'status':beval[13], 'html_content': webauthorprofile_templates.tmpl_collab_box(collab, bibauthorid_data, ln, add_box=False, loading=not beval[13])}})

            req.content_type = 'application/json'
            req.write(json.dumps(json_response))
        else:
            gboxstatus = self.person_id
            if False not in beval:
                gboxstatus = 'noAjax'
            req.write('<script type="text/javascript">var gBOX_STATUS = "%s" </script>' % (gboxstatus))
            req.write(webauthorprofile_templates.tmpl_author_page(req,
                                            pubs, \
                                            selfpubs, \
                                            authorname, \
                                            totaldownloads, \
                                            author_aff_pubs, \
                                            citedbylist, kwtuples, \
                                            coauthors, vtuples, \
                                            db_names_dict, person_link, \
                                            bibauthorid_data, \
                                            summarize_records, \
                                            hepdict, \
                                            collab, \
                                            ln, \
                                            beval, \
                                            oldest_cache_date,
                                            recompute_allowed))
    def create_authorpage_websearch(self, req, form, person_id, ln='en', expire_cache=False):

        recompute_allowed = True

        oldest_cache_date = get_person_oldest_date(person_id)
        if oldest_cache_date:
            delay = datetime.datetime.now() - oldest_cache_date
            if delay > RECOMPUTE_ALLOWED_DELAY:
                if expire_cache:
                    recompute_allowed = False
                    expire_all_cache_for_person(person_id)
            else:
                recompute_allowed = False

        if CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID:
            if person_id < 0:
                return ("Critical Error. PersonID should never be less than 0!")

        pubs, pubsStatus = get_pubs(person_id)
        if not pubs:
            pubs = []

        selfpubs, selfpubsStatus = get_self_pubs(person_id)
        if not selfpubs:
            selfpubs = []

        namesdict, namesdictStatus = get_person_names_dicts(person_id)
        if not namesdict:
            namesdict = {}

        try:
            authorname = namesdict['longest']
            db_names_dict = namesdict['db_names_dict']
        except (IndexError, KeyError):
            authorname = 'None'
            db_names_dict = {}

        #author_aff_pubs, author_aff_pubsStatus = (None, None)
        author_aff_pubs, author_aff_pubsStatus = get_institute_pub_dict(person_id)
        if not author_aff_pubs:
            author_aff_pubs = {}


        coauthors, coauthorsStatus = get_coauthors(person_id)
        if not coauthors:
            coauthors = {}

        summarize_records, summarize_recordsStatus = get_summarize_records(person_id, 'hcs', ln)
        if not summarize_records:
            summarize_records = 'None'

        totaldownloads, totaldownloadsStatus = get_total_downloads(person_id)
        if not totaldownloads:
            totaldownloads = 0

        citedbylist, citedbylistStatus = get_cited_by_list(person_id)
        if not citedbylist:
            citedbylist = 'None'

        kwtuples, kwtuplesStatus = get_kwtuples(person_id)
        if kwtuples:
            pass
            #kwtuples = kwtuples[0:MAX_KEYWORD_LIST]
        else:
            kwtuples = []

        collab, collabStatus = get_collabtuples(person_id)

        vtuples, venuetuplesStatus = get_venuetuples(person_id)
        if vtuples:
            pass
            #vtuples = venuetuples[0:MAX_VENUE_LIST]
        else:
            vtuples = str(vtuples)

        person_link, person_linkStatus = get_veryfy_my_pubs_list_link(person_id)
        if not person_link or not person_linkStatus:
            bibauthorid_data = {"is_baid": True, "pid":person_id, "cid": None}
            person_link = str(person_id)
        else:
            bibauthorid_data = {"is_baid": True, "pid":person_id, "cid": person_link}

        hepdict, hepdictStatus = get_hepnames_data(person_id)

        oldest_cache_date = get_person_oldest_date(person_id)

        #req.write("\nPAGE CONTENT START\n")
        #req.write(str(time.time()))
        #eval = [not_empty(x) or y for x, y in
        beval = [y for _, y in
                                               [(authorname, namesdictStatus) ,
                                               (totaldownloads, totaldownloadsStatus),
                                               (author_aff_pubs, author_aff_pubsStatus),
                                               (citedbylist, citedbylistStatus),
                                               (kwtuples, kwtuplesStatus),
                                               (coauthors, coauthorsStatus),
                                               (vtuples, venuetuplesStatus),
                                               (db_names_dict, namesdictStatus),
                                               (person_link, person_linkStatus),
                                               (summarize_records, summarize_recordsStatus),
                                               (pubs, pubsStatus),
                                               (hepdict, hepdictStatus),
                                               (selfpubs, selfpubsStatus),
                                               (collab, collabStatus)]]
        #not_complete = False in eval
        #req.write(str(eval))

        if form.has_key('jsondata'):
            json_response = {'boxes_info': {}}
            json_data = json.loads(str(form['jsondata']))
            json_data = json_unicode_to_utf8(json_data)
            # loop to check which boxes need content
            json_response['boxes_info'].update({'name_variants': {'status':beval[0], 'html_content': webauthorprofile_templates.tmpl_author_name_variants_box(req, db_names_dict, bibauthorid_data, ln, add_box=False, loading=not beval[0])}})
            json_response['boxes_info'].update({'combined_papers': {'status':(beval[3] and beval[12]), 'html_content': webauthorprofile_templates.tmpl_papers_with_self_papers_box(req, pubs, selfpubs, bibauthorid_data, totaldownloads, ln, add_box=False, loading=not beval[3])}})
            #json_response['boxes_info'].update({'papers': {'status':beval[3], 'html_content': webauthorprofile_templates.tmpl_papers_box(req, pubs, bibauthorid_data, totaldownloads, ln, add_box=False, loading=not beval[3])}})
            json_response['boxes_info'].update({'selfpapers': {'status':beval[12], 'html_content': webauthorprofile_templates.tmpl_self_papers_box(req, selfpubs, bibauthorid_data, totaldownloads, ln, add_box=False, loading=not beval[12])}})
            json_response['boxes_info'].update({'keywords': {'status':beval[4], 'html_content': webauthorprofile_templates.tmpl_keyword_box(kwtuples, bibauthorid_data, ln, add_box=False, loading=not beval[4])}})
            json_response['boxes_info'].update({'affiliations': {'status':beval[2], 'html_content': webauthorprofile_templates.tmpl_affiliations_box(author_aff_pubs, ln, add_box=False, loading=not beval[2])}})
            json_response['boxes_info'].update({'coauthors': {'status':beval[5], 'html_content': webauthorprofile_templates.tmpl_coauthor_box(bibauthorid_data, coauthors, ln, add_box=False, loading=not beval[5])}})
            json_response['boxes_info'].update({'numpaperstitle': {'status':beval[10], 'html_content': webauthorprofile_templates.tmpl_numpaperstitle(bibauthorid_data, pubs)}})
            json_response['boxes_info'].update({'authornametitle': {'status':beval[7], 'html_content': webauthorprofile_templates.tmpl_authornametitle(db_names_dict)}})
            json_response['boxes_info'].update({'citations': {'status':beval[9], 'html_content': summarize_records}})
            json_response['boxes_info'].update({'hepdata': {'status':beval[11], 'html_content':webauthorprofile_templates.tmpl_hepnames(hepdict, ln, add_box=False, loading=not beval[11])}})
            json_response['boxes_info'].update({'collaborations': {'status':beval[13], 'html_content': webauthorprofile_templates.tmpl_collab_box(collab, bibauthorid_data, ln, add_box=False, loading=not beval[13])}})

            req.content_type = 'application/json'
            req.write(json.dumps(json_response))
        else:
            gboxstatus = self.person_id
            if False not in beval:
                gboxstatus = 'noAjax'
            req.write('<script type="text/javascript">var gBOX_STATUS = "%s" </script>' % (gboxstatus))
            req.write(webauthorprofile_templates.tmpl_author_page(req,
                                            pubs, \
                                            selfpubs, \
                                            authorname, \
                                            totaldownloads, \
                                            author_aff_pubs, \
                                            citedbylist, kwtuples, \
                                            coauthors, vtuples, \
                                            db_names_dict, person_link, \
                                            bibauthorid_data, \
                                            summarize_records, \
                                            hepdict, \
                                            collab, \
                                            ln, \
                                            beval, \
                                            oldest_cache_date,
                                            recompute_allowed))