Python: Redeem html mysql text

0

I'm using Bottle.py for study and testing ... I'm having a problem retrieving a database information. The table looks like this:

create table if not exists postagens (
    idPostagem INTEGER NOT NULL auto_increment PRIMARY KEY,
    tituloPostagem VARCHAR(100),
    assunto varchar(100),
    conteudoPostagem TEXT,
    imgPath VARCHAR(255),
    dataRegistro DATETIME
);

Here's my bank record.

('1', 'teste', 'lop', '<p>testando testando<em> testando testando testando testando</em></p>\r\n<p style=\"text-align: right;\"><strong>testando testando testando testando testando testando</strong></p>', '18010004_1268615233256136_1367753241579175253_n.jpg', '2018-01-28 01:02:43')

Here the method with select in the file adm.py as manager: obs: select * from **** because it is for testing only.

def view_publicacoes(nomePostagem):
    cursor.execute("select * from postagens;")
    return cursor.fetchall()

Here the route method

@app.route("/postagens/<nomePostagem>")
def view_publicacoes(nomePostagem):
    a = manager.view_publicacoes(nomePostagem)
    return template('./html/teste.tpl', lbImg=a[0][4], lbTituloPost=a[0][1], lbData=a[0][5], lbContent=a[0][3])

It brings the text, but it does not stylize it as it should in html, and when I inspect the element where the text is located it shows me as if it were a string.

  

Testing testing > testing by testing by testing < / p >    Testing Testing Testing Testing Testing

I've already coded for unicode, for str, converted to byte and decoded in the presentation, I tried to use BLOB instead of text ... And the only thing I could notice is this only happens with large texts ... I await response

    
asked by anonymous 28.01.2018 / 04:47

0 answers