web.py: ajout de la fonction _utf8plaintext()

This commit is contained in:
Jephté Clain 2017-07-17 21:59:00 +04:00
parent 335ca05aaa
commit 3f464145aa
1 changed files with 4 additions and 0 deletions

View File

@ -233,6 +233,10 @@ class Page(object):
def redirect(self, path, **kw):
return web.redirect(web.url(path, **kw))
def _utf8plaintext(self, text):
web.header("Content-Type", "text/plain; charset=utf-8", True)
return text.encode("utf-8")
def r(self, name, *args, **kw):
templatedir = getattr(self, 'TEMPLATEDIR', None)
if templatedir is not None: