Correctly handle text. .string does weird things.

This commit is contained in:
Klaus-Uwe Mitterer 2017-01-29 23:09:16 +01:00
parent 89472538eb
commit c53ffa66dc

View file

@ -58,7 +58,7 @@ def messageHandler(sender, recipient, mid, date, driver, mode = 0, db = dbtools.
juha = BeautifulSoup(driver.page_source, "html5lib")
text = juha.select("div.msg div")[0]
db.executeQuery("INSERT INTO messages(id, text, sender_id, recipient_id, created_at) VALUES('%s', '%s', '%s', '%s', '%s');" % (mid, setuptools.unescapeText(text.string or "").strip(), sender, recipient, date))
db.executeQuery("INSERT INTO messages(id, text, sender_id, recipient_id, created_at) VALUES('%s', '%s', '%s', '%s', '%s');" % (mid, setuptools.unescapeText(text.text).strip(), sender, recipient, date))
db.commit()
try: