def post(self): name, href = self._argument() current_user_id = self.current_user_id txt = self.get_argument('word', None) if href: if name: name = ''.join([name, '[[', href, ']]']) if txt: txt = name + txt else: txt = name else: txt = '[[' + href + ']]' + txt elif name: txt = name + ' ' + txt if txt: host = self.request.host zsite = zsite_by_domain(host) if zsite and zsite.cid == CID_SITE: zsite_id = zsite.id else: zsite_id = 0 m = po_word_new(current_user_id, txt, zsite_id=zsite_id) self.render(success=True)
def post(self): result = None current_user_id = self.current_user_id txt = self.get_argument('txt', None) if txt: host = self.request.host zsite = zsite_by_domain(host) if zsite and zsite.cid == CID_SITE: zsite_id = zsite.id else: zsite_id = 0 m = po_word_new(current_user_id, txt, zsite_id=zsite_id) if not zsite_id and m: c_dict = career_dict(set([current_user_id])) unit, title = c_dict[current_user_id] result = [ [ 1, zsite.name, zsite.link, unit, title, pic_url_with_default(current_user_id, '219'), [[m.id, [], 0, 61, 0, 0, 0, time.time(), None, txt_withlink(txt), False]] ], [] ] self.finish(dumps(result))
def get(self, to_id=0): current_user = self.current_user current_user_id = self.current_user_id if to_id: zsite = Zsite.mc_get(to_id) else: host = self.request.host zsite = zsite_by_domain(host) if zsite: zsite_id = zsite.id cid = zsite.cid if cid in (CID_SITE, CID_COM, CID_TAG): zsite_fav_new(zsite, current_user_id) elif cid == CID_USER: follow_new(current_user_id, zsite_id) mq_buzz_follow_new(current_user_id, zsite_id) txt = self.get_argument('txt', None) if txt: if cid == CID_SITE: from model.reply import STATE_ACTIVE zsite.reply_new(current_user, txt, STATE_ACTIVE) elif cid == CID_COM: from model.po_review import po_review_new po_review_new(zsite_id, current_user_id, name) self.finish('{}')
def post(self): name, href = self._argument() current_user_id = self.current_user_id txt = self.get_argument('word', None) if href: if name: name = ''.join([name, '[[', href, ']]']) if txt: txt = name+txt else: txt = name else: txt = '[['+href+']]'+txt elif name: txt = name+' '+txt if txt: host = self.request.host zsite = zsite_by_domain(host) if zsite and zsite.cid == CID_SITE: zsite_id = zsite.id else: zsite_id = 0 m = po_word_new(current_user_id, txt, zsite_id=zsite_id) self.render(success=True)
def post(self): result = None current_user_id = self.current_user_id txt = self.get_argument('txt', None) if txt: host = self.request.host zsite = zsite_by_domain(host) if zsite and zsite.cid == CID_SITE: zsite_id = zsite.id else: zsite_id = 0 m = po_word_new(current_user_id, txt, zsite_id=zsite_id) if not zsite_id and m: c_dict = career_dict(set([current_user_id])) unit, title = c_dict[current_user_id] result = [[ 1, zsite.name, zsite.link, unit, title, pic_url_with_default(current_user_id, '219'), [[ m.id, [], 0, 61, 0, 0, 0, time.time(), None, txt_withlink(txt), False ]] ], []] self.finish(dumps(result))
def get(self, to_id=0): current_user = self.current_user current_user_id = self.current_user_id if to_id: zsite = Zsite.mc_get(to_id) else: host = self.request.host zsite = zsite_by_domain(host) if zsite: zsite_id = zsite.id cid = zsite.cid if cid in (CID_SITE, CID_COM, CID_TAG): zsite_fav_new(zsite, current_user_id) elif cid == CID_USER: follow_new(current_user_id, zsite_id) mq_buzz_follow_new(current_user_id, zsite_id) txt = self.get_argument("txt", None) if txt: if cid == CID_SITE: from model.reply import STATE_ACTIVE zsite.reply_new(current_user, txt, STATE_ACTIVE) elif cid == CID_COM: from model.po_review import po_review_new po_review_new(zsite_id, current_user_id, name) self.finish("{}")
def post(self): current_user = self.current_user current_user_id = self.current_user_id host = self.request.host zsite = zsite_by_domain(host) if zsite and zsite.cid in (CID_SITE, CID_COM): zsite_fav_rm(zsite, current_user_id) self.finish('{}')
def prepare(self): super(JLoginBase, self).prepare() request = self.request host = request.host zsite = zsite_by_domain(host) if zsite is None: self.zsite_id = 0 else: self.zsite_id = zsite.id self.zsite = zsite zsite = self.zsite
def prepare(self): super(AdminBase, self).prepare() request = self.request host = request.host zsite = zsite_by_domain(host) if zsite is None: self.zsite_id = 0 else: self.zsite_id = zsite.id self.zsite = zsite zsite = self.zsite if not zsite.cid == CID_COM or not zsite_member_can_admin(self.zsite_id, self.current_user_id): self.finish("{}")
def prepare(self): super(AdminBase, self).prepare() request = self.request host = request.host zsite = zsite_by_domain(host) if zsite is None: self.zsite_id = 0 else: self.zsite_id = zsite.id self.zsite = zsite zsite = self.zsite if not zsite.cid == CID_COM or not zsite_member_can_admin( self.zsite_id, self.current_user_id): self.finish('{}')
def post(self, to_id=0): current_user = self.current_user current_user_id = self.current_user_id if to_id: zsite = Zsite.mc_get(to_id) else: host = self.request.host zsite = zsite_by_domain(host) if zsite: cid = zsite.cid if cid in (CID_SITE, CID_COM, CID_TAG): zsite_fav_rm(zsite, current_user_id) elif cid == CID_USER: follow_rm(current_user_id, zsite.id) self.finish("{}")
def post(self, to_id=0): current_user = self.current_user current_user_id = self.current_user_id if to_id: zsite = Zsite.mc_get(to_id) else: host = self.request.host zsite = zsite_by_domain(host) if zsite: cid = zsite.cid if cid in (CID_SITE, CID_COM, CID_TAG): zsite_fav_rm(zsite, current_user_id) elif cid == CID_USER: follow_rm(current_user_id, zsite.id) self.finish('{}')
def prepare(self): request = self.request host = request.host _host = url_by_digit_domain(host) if _host: path = '//%s%s'%(_host, request.path) if request.query: path = '%s?%s'%(path, request.query) return self.redirect(path, True) zsite = zsite_by_domain(host) if zsite is None: self.zsite_id = 0 else: self.zsite_id = zsite.id self.zsite = zsite super(Base, self).prepare()
def prepare(self): request = self.request host = request.host _host = url_by_digit_domain(host) if _host: path = '//%s%s' % (_host, request.path) if request.query: path = '%s?%s' % (path, request.query) return self.redirect(path, True) zsite = zsite_by_domain(host) if zsite is None: self.zsite_id = 0 else: self.zsite_id = zsite.id self.zsite = zsite super(Base, self).prepare()
def get(self): current_user = self.current_user current_user_id = self.current_user_id host = self.request.host zsite = zsite_by_domain(host) zsite_id = zsite.id cid = zsite.cid if zsite and cid in (CID_SITE, CID_COM): zsite_fav_new(zsite, current_user_id) txt = self.get_argument('txt', None) if txt: if cid == CID_SITE: from model.reply import STATE_ACTIVE zsite.reply_new(current_user, txt, STATE_ACTIVE) elif cid == CID_COM: from model.po_review import po_review_new po_review_new(zsite_id, current_user_id, name) self.finish('{}')