def index(self, req, form): ''' Serve the main person page. Will use the object's person id to get a person's information. @param req: Apache Request Object @type req: Apache Request Object @param form: Parameters sent via GET or POST request @type form: dict @return: a full page formatted in HTML @return: string ''' argd = wash_urlargd(form, {'ln': (str, CFG_SITE_LANG), 'verbose': (int, 0), 'recid': (int, -1), 'recompute': (int, 0) }) ln = argd['ln'] expire_cache = False if 'recompute' in argd and argd['recompute']: expire_cache = True if CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID: try: self.person_id = int(self.person_id) except (TypeError, ValueError): #In any case, if the parameter is invalid, go to a person search page self.person_id = -1 return redirect_to_url(req, "%s/person/search?q=%s" % (CFG_SITE_URL, self.original_search_parameter)) if self.person_id < 0: return redirect_to_url(req, "%s/person/search?q=%s" % (CFG_SITE_URL, self.original_search_parameter)) else: self.person_id = self.original_search_parameter if form.has_key('jsondata'): req.content_type = "application/json" self.create_authorpage_websearch(req, form, self.person_id, ln) return else: req.content_type = "text/html" req.send_http_header() metaheaderadd = '<script type="text/javascript" src="%s/js/webauthorprofile.js"> </script>' % (CFG_SITE_URL) metaheaderadd += """ <style> .hidden { display: none; } </style> """ title_message = "Author Publication Profile Page" req.write(pageheaderonly(req=req, title=title_message, metaheaderadd=metaheaderadd, language=ln)) req.write(websearch_templates.tmpl_search_pagestart(ln=ln)) self.create_authorpage_websearch(req, form, self.person_id, ln, expire_cache) return page_end(req, 'hb', ln)