Example #1
0
 def get(self):
     msg_lst = []
     ret = getmsgs()
     if ret:
         for i in ret:
             m = dict()
             m['id'] = i['id']
             m['who'] = i['who']
             m['text'] = i['t'].encode('utf-8')
             if i['answer_id']:
                 pass
             else:
                 m['answer'] = '尚未产生'
             msg_lst.append(m)
     self.render(msg_lst=msg_lst)
Example #2
0
File: index.py Project: 42qu/zqa
    def get(self):
        msg_lst = []
        ret = getmsgs()
        if ret:
            for i in ret:
                m = dict()
                m['id'] = i['id']
                m['who'] = i['who']
                m['text'] = i['t'].encode('utf-8')
                if i['answer_id']:
                    re = getreply(i['answer_id'])
                    m['answer'] = {
                        'text': re['t'].encode('utf-8').replace(r'\n','<br />'),
                        'who' : re['who'].encode('utf-8')
                    }
                else:
                    m['answer'] = {'text':'尚未产生','who':None}

                msg_lst.append(m)
        self.render(msg_lst=msg_lst)
Example #3
0
File: index.py Project: alemic/zqa
    def get(self):
        msg_lst = []
        ret = getmsgs()
        if ret:
            for i in ret:
                m = dict()
                m['id'] = i['id']
                m['who'] = i['who']
                m['text'] = i['t'].encode('utf-8')
                if i['answer_id']:
                    re = getreply(i['answer_id'])
                    m['answer'] = {
                        'text':
                        re['t'].encode('utf-8').replace(r'\n', '<br />'),
                        'who': re['who'].encode('utf-8')
                    }
                else:
                    m['answer'] = {'text': '尚未产生', 'who': None}

                msg_lst.append(m)
        self.render(msg_lst=msg_lst)