<NME> pdf.py
<BEF> from rst2pdf.createpdf import RstToPdf
import codecs
utf8codec = codecs.lookup('utf-8')

from flask import current_app

try:
    from cStringIO import StringIO
    from StringIO import StringIO

def rst2pdf(content, theme=None):
    topdf = RstToPdf(basedir=current_app.config.root_path, breaklevel=0)
    topdf = RstToPdf(basedir=current_app.config.root_path, breaklevel=0)

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

<MSG> refactor: use flask request to retieve text

Use Flask's `request.form` to retrieve text using form name.

<DFF> @@ -3,6 +3,7 @@ import codecs
 utf8codec = codecs.lookup('utf-8')
 
 from flask import current_app
+from flask import request
 
 try:
     from cStringIO import StringIO
@@ -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]

refactor: use flask request to retieve text