I have an sql database where every row contains paragraphs of text. I want to display each row of text in it's own html textarea. I'm using python to generate the html page. I've tried the following but the body of the textarea is always empty. Does anyone know what I can do to fix this?
# didn't work
# dict = {'example':results[i]["Teaser"].replace("\"", "\\\"").replace("<", "<").replace(">", ">"), 'arg':results[i]["GImageID"]}
# s = "<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra{arg}\">maybe1 - {example}</textarea>".format(**dict)
# gives an error on the d even though a tutorial said I should do it this way
# s = "<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra{arg:d}\">maybe2 - {example:d}</textarea>".format(**dict)
#extra += s
#------------------------------------------------------
teaser = results[i]["Teaser"].replace("\"", "\\\"").replace("<", "<").replace(">", ">")
# didn't work - empty
# extra += "<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra{arg}\">maybe3 - {example}</textarea>".format(example=teaser, arg=results[i]["GImageID"])
# didn't work - empty
# extra += "<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra{arg}\">maybe3.5 - {example}</textarea>".format(example=results[i]["GImageTeaser"].replace("\"", "\\\"").replace("<", "<").replace(">", ">"), arg=results[i]["GImageID"])
# didn't work - empty
# t = Template("<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra$arg\">maybe4 - $example</textarea>")
# s = t.substitute({ 'example': results[i]["Teaser"].replace("\"", "\\\"").replace("<", "<").replace(">", ">"), 'arg': results[i]["GImageID"]})
# extra += s
# didn't work - empty
# html = Template("<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra$arg\">maybe5 - $example</textarea>")
# result = html.safe_substitute(example=teaser,arg='Vishnu')
# result = html.safe_substitute(example=results[i]["Teaser"].replace("\"", "\\\"").replace("<", "<").replace(">", ">"),arg='Vishnu')
# extra += result
# didn't work - empty
# extra += """<br><textarea class=\"\" rows=\"2\" cols=\"20\" id=\"extra%d\">maybe6 - %s</textarea>""" % (results[i]["GImageID"], results[i]["Teaser"].replace("\"", "\\\"").replace("<", "<").replace(">", ">"))
The text above is in a for loop
for i in range(len(results)):
and I've outputted the text results[i]["Teaser"] to verify that's it's not empty. The GImageID prints out fine, but the Teaser text that contains the paragraphs is always empty.
If you need any additional information please let me know. I've been stuck for hours, and I can't find any working solution. Thanks!