Skip to content

Commit

Permalink
refactor: use flask request to retieve text
Browse files Browse the repository at this point in the history
Use Flask's `request.form` to retrieve text using form name.
  • Loading branch information
anshulxyz committed Aug 19, 2017
1 parent 7750caf commit 502fe26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rsted/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
utf8codec = codecs.lookup('utf-8')

from flask import current_app
from flask import request

try:
from cStringIO import StringIO
Expand All @@ -13,6 +14,9 @@ def rst2pdf(content, theme=None):
topdf = RstToPdf(basedir=current_app.config.root_path, breaklevel=0)

buf = StringIO()

content = request.form['text']

if not content:
content = '\0'
content_utf8 = utf8codec.encode(content)[0]
Expand Down

0 comments on commit 502fe26

Please sign in to comment.