Commits

Tobias Berling  committed 3377ede

Return URL as text/plain + added make_plain_response().

  • Participants
  • Parent commits b9248cb

Comments (0)

Files changed (1)

             db.cursor().executescript(f.read())
         db.commit()
 
+def make_plain_response(*args, **kwargs):
+    response = make_response(*args,**kwargs)
+    response.mimetype = 'text/plain'
+    return response
 
 def new_key():
     key = ''
         """, [key, content])
     g.db.commit()
 
-    return "%s%s\n" % (request.url_root, key)
+    return make_plain_response(" %s%s\n" % (request.url_root, key))
 
 @app.route('/<key>')
 def get(key):
     content = content['content']
 
     if not a.keys():
-        response = make_response("%s\n" % content)
-        response.mimetype='text/plain'
-        return response
+        return make_plain_response("%s\n" % content)
 
     from pygments import highlight
     from pygments.lexers import get_lexer_by_name