0
I am using Bottle.py for study and testing... I have a problem in retrieving a database information. The table is 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 is the method with select in the Adm.py as manager file: 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 does not style 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.
<p>testing by testing<em> testing by testing by testing</em></p> <p style="text-align: right;"><Strong>testing testing testing testing testing testing</Strong></p>
I have already encoded to Unicode, to str, converted to byte and decoded in the presentation, tried to use BLOB instead of text... And the only thing I could notice is this only happens with large texts... I await reply.
I managed to put ! in the view.
– Afonso
Then there are 2 options: delete the question if you think it will not be useful in the future or post an answer (recommended) explaining how you solved it in case someone might have the same problem can solve.
– Sam