Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
 def get(self):
     user_id = self.current_user_id
     txt = self.get_argument('txt')
     result = {}
     if txt.strip():
         m = po_word_new(user_id, txt)
         if m:
             result['id'] = m.id
             result['link'] = 'http:%s'%m.link
     self.finish(result)
Ejemplo n.º 6
0
 def get(self):
     user_id = self.current_user_id
     txt = self.get_argument('txt')
     result = {}
     if txt.strip():
         m = po_word_new(user_id, txt)
         if m:
             result['id'] = m.id
             result['link'] = 'http:%s' % m.link
     self.finish(result)
Ejemplo n.º 7
0
 def post(self):
     current_user = self.current_user
     txt = self.get_argument('txt', '')
     if txt:
         po_word_new(current_user.id, txt)
Ejemplo n.º 8
0
 def post(self):
     current_user = self.current_user
     txt = self.get_argument('txt', '')
     if txt:
         po_word_new(current_user.id, txt)
     return self.redirect('/feed')
Ejemplo n.º 9
0
 def post(self):
     current_user = self.current_user
     txt = self.get_argument('txt', '')
     if txt:
         po_word_new(current_user.id, txt)
Ejemplo n.º 10
0
 def post(self):
     current_user = self.current_user
     txt = self.get_argument('txt', '')
     if txt:
         po_word_new(current_user.id, txt)
     return self.redirect('/feed')