Mercurial > hg > decoupage
diff decoupage/web.py @ 82:8596a1d97740
unicode
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 29 Nov 2013 20:45:20 -0800 |
parents | 5330cd62e179 |
children | 95820b36d7e3 |
line wrap: on
line diff
--- a/decoupage/web.py Fri Jul 05 14:03:12 2013 -0700 +++ b/decoupage/web.py Fri Nov 29 20:45:20 2013 -0800 @@ -3,7 +3,7 @@ """ # TODO: -# files like `index.ini` +# handle files with `#`s like like `#index.ini` # -> http://k0s.org/portfolio/ideas/#index.ini# # # oops. Handle it better @@ -38,7 +38,8 @@ 'directory': None, # directory to serve 'cascade': 'True', # whether to cascade configuration 'template': 'index.html', # XXX see below - 'template_directories': '' # list of directories to look for templates + 'template_directories': '', # list of directories to look for templates + 'charset': 'utf-8', # content encoding for index.html files; -> `Content-Type: text/html; charset=ISO-8859-1` } def __init__(self, **kw): @@ -103,7 +104,6 @@ auto_reload=self.auto_reload) - ### methods dealing with HTTP def __call__(self, environ, start_response): @@ -234,8 +234,13 @@ return self.fileserver(local_index) raise + # set charset if given + kw = {} + if self.charset: + kw['charset'] = self.charset + # return response - return Response(content_type='text/html', body=res) + return Response(content_type='text/html', body=res, **kw) ### internal methods