fix content type

This commit is contained in:
spez
2008-09-30 12:36:10 -07:00
parent 9bfdd5e5ee
commit c6797b61d9
2 changed files with 7 additions and 3 deletions

View File

@@ -300,6 +300,10 @@ class ExtensionMiddleware(object):
#strip off the extension
environ['PATH_INFO'] = path[:-(len(ext) + 1)]
break
else:
environ['render_style'] = 'html'
environ['content_type'] = 'text/html; charset=UTF-8'
return self.app(environ, start_response)
class RewriteMiddleware(object):

View File

@@ -247,10 +247,10 @@ def set_subreddit():
def set_content_type():
e = request.environ
if e.has_key('extension'):
c.render_style = e['render_style']
c.response_content_type = e['content_type']
c.render_style = e['render_style']
c.response_content_type = e['content_type']
if e.has_key('extension'):
ext = e['extension']
if ext == 'api' or ext.startswith('json'):
c.response_access_control = 'allow <*>'