def post(self): errtip, link_cid, link_kv, name, motto, url, txt, pic_id = self._site_save() current_user_id = self.current_user_id zsite_id = self.zsite_id zsite = self.zsite success = False if not errtip: success = True if not url_by_id(zsite_id) and url: url_new(zsite_id, url) zsite.name = name zsite.save() link_list_save(zsite_id, link_cid, link_kv) txt_new(zsite_id, txt) motto_set(zsite_id, motto) site_ico_bind(current_user_id, pic_id, zsite_id) search_new(zsite_id) self.render( success=success, errtip=errtip, link_cid=link_cid, link_list=link_kv, name=name, motto=motto, txt=txt, pic_id=pic_id, url=url )
def post(self): errtip, link_cid, link_kv, name, motto, url, txt, pic_id = self._site_save( ) current_user_id = self.current_user_id zsite_id = self.zsite_id zsite = self.zsite success = False if not errtip: success = True if not url_by_id(zsite_id) and url: url_new(zsite_id, url) zsite.name = name zsite.save() link_list_save(zsite_id, link_cid, link_kv) txt_new(zsite_id, txt) motto_set(zsite_id, motto) site_ico_bind(current_user_id, pic_id, zsite_id) search_new(zsite_id) self.render(success=success, errtip=errtip, link_cid=link_cid, link_list=link_kv, name=name, motto=motto, txt=txt, pic_id=pic_id, url=url)
def zsite2keyword(z): r = [] t = defaultdict(int) id = z.id name = z.name if name: for word in seg_title_search(name): t[word] += 2 url = url_by_id(id) if url: t[url] += 2 if z.cid == CID_SITE: for word in seg_title_search(motto_get(id)): t[word] += 1 elif z.cid == CID_USER: mail = mail_by_user_id(id) if mail: t[mail] += 2 t[mail.split('@', 1)[0]] += 2 txt = txt_get(id) if txt: man_txt_len = len(txt) for word in seg_txt_search(txt): t[word] += 1 for seq, career in enumerate(career_list_all(id)): if seq: add = 1 else: add = 2 unit = career.unit title = career.title txt = career.txt if unit: for word in seg_title_search(unit): t[word] += add if title: for word in seg_title_search(title): t[word] += add if txt: for word in seg_txt_search(txt): t[word] += add return t
def autocomplete_user_new(user): from model.user_mail import mail_by_user_id id = user.id rank = follow_count_by_to_id(id) autocomplete_user_name_new(user, rank) autocomplete_user_mail_new(user, mail_by_user_id(id), rank) url = url_by_id(id) if url: autocomplete_user_url_new(user, url, rank)
def autocomplete_user_new(user): from model.user_mail import mail_by_user_id id = user.id rank = follow_count_by_to_id(id) autocomplete_user_name_new(user, rank) autocomplete_user_mail_new(user, mail_by_user_id(id), rank ) url = url_by_id(id) if url: autocomplete_user_url_new(user, url, rank)
def prepare(self): super(Url, self).prepare() if not self._finished: user = self.current_user current_user_id = self.current_user_id link = self.current_user.link if user.state <= ZSITE_STATE_APPLY: self.redirect(link + '/i/verify') elif url_by_id(current_user_id): self.redirect(link)
def prepare(self): super(Url, self).prepare() if not self._finished: user = self.current_user current_user_id = self.current_user_id link = self.current_user.link if user.state <= ZSITE_STATE_APPLY: self.redirect(link+'/i/verify') elif url_by_id(current_user_id): self.redirect(link)
def tag_alias_by_id_query(id, query=None): if query is None: mail = mail_by_user_id(id) return [ url_by_id(id), mail, mail.rsplit("@",1)[0], ] url = url_by_id(id) if query in url.lower(): return url mail = mail_by_user_id(id) if query == mail: return mail elif query in mail: return mail.rsplit("@",1)[0] return 0
def tag_alias_by_id_query(id, query=None): if query is None: mail = mail_by_user_id(id) return [ url_by_id(id), mail, mail.rsplit("@", 1)[0], ] url = url_by_id(id) if query in url.lower(): return url mail = mail_by_user_id(id) if query == mail: return mail elif query in mail: return mail.rsplit("@", 1)[0] return 0
def post(self): current_user_id = self.current_user_id url = self.get_argument('url', None) if url: if url_by_id(current_user_id): error_url = '个性域名设置后不能修改' else: error_url = url_valid(url) if error_url is None: url_new(current_user_id, url) self.redirect(SITE_URL) else: error_url = '个性域名不能为空' self.render( error_url=error_url, url=url )
def post(self): current_user_id = self.current_user_id current_user = self.current_user url = self.get_argument('url', None) if url: if url_by_id(current_user_id): error_url = '个性域名设置后不能修改' else: error_url = url_valid(url) if error_url is None: url_new(current_user_id, url) from model.autocomplete_user import autocomplete_user_url_new autocomplete_user_url_new(current_user, url) self.redirect(SITE_URL) else: error_url = '个性域名不能为空' self.render(error_url=error_url, url=url)
def post(self): current_user_id = self.current_user_id current_user = self.current_user url = self.get_argument("url", None) if url: if url_by_id(current_user_id): error_url = "个性域名设置后不能修改" else: error_url = url_valid(url) if error_url is None: url_new(current_user_id, url) from model.autocomplete_user import autocomplete_user_url_new autocomplete_user_url_new(current_user, url) self.redirect(SITE_URL) else: error_url = "个性域名不能为空" self.render(error_url=error_url, url=url)
def man_show_api(man_id): man = Zsite.mc_get(man_id) if man: comp, title = career_current(man_id) txt = txt_get(man_id) link = man.link li = [ ('id', man_id), ('name', man.name), ('uid', url_by_id(man_id)), ('company', comp), ('title', title), ('signature', motto_get(man_id)), ('about_me', txt), ('ico', pic_url(man_id, 219)), ('link', name_link_by_zsite_id(man_id, 'http:')), ('appearance_fee', 42), ] return dict(filter(lambda x:bool(x[1]), li)) return {}
def man_show_api(man_id): man = Zsite.mc_get(man_id) if man: comp, title = career_current(man_id) txt = txt_get(man_id) link = man.link li = [ ('id', man_id), ('name', man.name), ('uid', url_by_id(man_id)), ('company', comp), ('title', title), ('signature', motto_get(man_id)), ('about_me', txt), ('ico', pic_url(man_id, 219)), ('link', name_link_by_zsite_id(man_id, 'http:')), ('appearance_fee', 42), ] return dict(filter(lambda x: bool(x[1]), li)) return {}
def get(self): super(Verify, self).prepare() from model.zsite_verify import zsite_verify_ajust current_user = self.current_user ajust = zsite_verify_ajust(current_user) if not self._finished: current_user_id = self.current_user_id state = current_user.state if state >= ZSITE_STATE_VERIFY: from model.zsite_url import url_by_id if not url_by_id(current_user_id): link = "/i/url" else: link = '/' return self.redirect(link) elif state <= ZSITE_STATE_APPLY: return self.redirect('/auth/verify/sended/%s' % current_user_id) self.render(ajust=ajust)
def get(self): super(Verify, self).prepare() from model.zsite_verify import zsite_verify_ajust current_user = self.current_user ajust = zsite_verify_ajust(current_user) if not self._finished: current_user_id = self.current_user_id state = current_user.state if state >= ZSITE_STATE_VERIFY: from model.zsite_url import url_by_id if not url_by_id(current_user_id): link = "/i/url" else: link = "/" return self.redirect(link) elif state <= ZSITE_STATE_APPLY: return self.redirect("/auth/verify/sended/%s" % current_user_id) self.render(ajust=ajust)