changeset 4176:85884c67228d

Replaced/removed calls to request.emit_http_headers
author Florian Krupicka <florian.krupicka@googlemail.com>
date Wed, 18 Jun 2008 00:28:07 +0200
parents 5bcd612588fc
children 632696c3c78d
files MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py MoinMoin/action/AttachFile.py MoinMoin/action/Despam.py MoinMoin/action/LikePages.py MoinMoin/action/LocalSiteMap.py MoinMoin/action/MyPages.py MoinMoin/action/SubscribeUser.py MoinMoin/action/__init__.py MoinMoin/action/backup.py MoinMoin/action/diff.py MoinMoin/action/dumpform.py MoinMoin/action/fckdialog.py MoinMoin/action/fullsearch.py MoinMoin/action/info.py MoinMoin/action/links.py MoinMoin/action/login.py MoinMoin/action/newaccount.py MoinMoin/action/pollsistersites.py MoinMoin/action/recoverpass.py MoinMoin/action/rss_rc.py MoinMoin/action/serveopenid.py MoinMoin/action/showtags.py MoinMoin/action/sisterpages.py MoinMoin/action/sitemap.py MoinMoin/action/thread_monitor.py MoinMoin/action/titleindex.py MoinMoin/action/userprefs.py MoinMoin/stats/hitcounts.py MoinMoin/stats/pagesize.py MoinMoin/stats/useragents.py MoinMoin/xmlrpc/__init__.py
diffstat 33 files changed, 54 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/Page.py	Wed Jun 18 00:28:07 2008 +0200
@@ -983,7 +983,6 @@
             request.setHttpHeader('Status: 404 NOTFOUND')
             text = u"Page %s not found." % self.page_name
 
-        request.emit_http_headers()
         request.write(text)
 
     def send_page(self, **keywords):
@@ -1077,12 +1076,12 @@
         page_exists = self.exists()
         if not content_only:
             if emit_headers:
-                request.setHttpHeader("Content-Type: %s; charset=%s" % (self.output_mimetype, self.output_charset))
+                request.response.content_type = "%s; charset=%s" % (self.output_mimetype, self.output_charset)
                 if page_exists:
                     if not request.user.may.read(self.page_name):
-                        request.setHttpHeader('Status: 403 Permission Denied')
+                        request.response.status_code = 403
                     else:
-                        request.setHttpHeader('Status: 200 OK')
+                        request.response.status_code = 200
                     if not request.cacheable:
                         # use "nocache" headers if we're using a method that is not simply "display"
                         request.disableHttpCaching(level=2)
@@ -1097,8 +1096,7 @@
                         #request.setHttpHeader("Last-Modified: %s" % util.timefuncs.formathttpdate(lastmod))
                         pass
                 else:
-                    request.setHttpHeader('Status: 404 NOTFOUND')
-                request.emit_http_headers()
+                    request.response.status_code = 404
 
             if not page_exists and self.request.isSpiderAgent:
                 # don't send any 404 content to bots
--- a/MoinMoin/PageEditor.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/PageEditor.py	Wed Jun 18 00:28:07 2008 +0200
@@ -196,7 +196,6 @@
 
         # Emmit http_headers after checks (send_page)
         request.disableHttpCaching(level=2)
-        request.emit_http_headers()
 
         # check if we want to load a draft
         use_draft = None
--- a/MoinMoin/PageGraphicalEditor.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/PageGraphicalEditor.py	Wed Jun 18 00:28:07 2008 +0200
@@ -52,7 +52,6 @@
         form = request.form
         _ = self._
         request.disableHttpCaching(level=2)
-        request.emit_http_headers()
 
         raw_body = ''
         msg = None
--- a/MoinMoin/action/AttachFile.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Wed Jun 18 00:28:07 2008 +0200
@@ -536,7 +536,6 @@
 def upload_form(pagename, request, msg=''):
     _ = request.getText
 
-    request.emit_http_headers()
     # Use user interface language for this generated page
     request.setContentLanguage(request.lang)
     request.theme.add_msg(msg, "dialog")
@@ -656,7 +655,6 @@
     if ext == '.map':
         os.utime(attach_dir, None)
 
-    request.emit_http_headers()
     request.write("OK")
 
 
@@ -808,9 +806,10 @@
     if not filename:
         return # error msg already sent in _access_file
 
-    timestamp = timefuncs.formathttpdate(int(os.path.getmtime(fpath)))
-    if request.if_modified_since == timestamp:
-        request.emit_http_headers(["Status: 304 Not modified"])
+    timestamp = os.path.getmtime(fpath)
+    if_modified = time.mktime(request.if_modified_since.timetuple())
+    if if_modified >= timestamp:
+        request.response.status_code = 304
     else:
         mt = wikiutil.MimeType(filename=filename)
         content_type = mt.content_type()
@@ -826,12 +825,11 @@
         dangerous = mime_type in request.cfg.mimetypes_xss_protect
         content_dispo = dangerous and 'attachment' or 'inline'
 
-        request.emit_http_headers([
-            'Content-Type: %s' % content_type,
-            'Last-Modified: %s' % timestamp,
-            'Content-Length: %d' % os.path.getsize(fpath),
-            'Content-Disposition: %s; filename="%s"' % (content_dispo, filename_enc),
-        ])
+        request.response.content_type = content_type
+        request.response.last_modified = timestamp
+        request.response.content_length = os.path.getsize(fpath)
+        content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
+        request.response.headers.add('Content-Disposition', content_dispo_string)
 
         # send data
         request.send_file(open(fpath, 'rb'))
@@ -1038,7 +1036,6 @@
         return
 
     # send header & title
-    request.emit_http_headers()
     # Use user interface language for this generated page
     request.setContentLanguage(request.lang)
     title = _('attachment:%(filename)s of %(pagename)s') % {
--- a/MoinMoin/action/Despam.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/Despam.py	Wed Jun 18 00:28:07 2008 +0200
@@ -187,7 +187,6 @@
     timestamp = time.time() - DAYS * 24 * 3600
     ok = request.form.get('ok', [0])[0]
 
-    request.emit_http_headers()
     request.theme.send_title("Despam", pagename=pagename)
     # Start content (important for RTL support)
     request.write(request.formatter.startContent("content"))
--- a/MoinMoin/action/LikePages.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/LikePages.py	Wed Jun 18 00:28:07 2008 +0200
@@ -41,8 +41,6 @@
         return
 
     # more than one match, list 'em
-    request.emit_http_headers()
-
     # This action generate data using the user language
     request.setContentLanguage(request.lang)
 
--- a/MoinMoin/action/LocalSiteMap.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/LocalSiteMap.py	Wed Jun 18 00:28:07 2008 +0200
@@ -31,7 +31,6 @@
 
 def execute(pagename, request):
     _ = request.getText
-    request.emit_http_headers()
 
     # This action generate data using the user language
     request.setContentLanguage(request.lang)
--- a/MoinMoin/action/MyPages.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/MyPages.py	Wed Jun 18 00:28:07 2008 +0200
@@ -58,7 +58,6 @@
     pagecontent = pagecontent.replace('\n', '\r\n')
 
     from MoinMoin.parser.text_moin_wiki import Parser as WikiParser
-    request.emit_http_headers()
 
     # This action generate data using the user language
     request.setContentLanguage(request.lang)
--- a/MoinMoin/action/SubscribeUser.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/SubscribeUser.py	Wed Jun 18 00:28:07 2008 +0200
@@ -16,7 +16,6 @@
 
 def show_form(pagename, request):
     _ = request.getText
-    request.emit_http_headers()
     request.theme.send_title(_("Subscribe users to the page %s") % pagename, pagename=pagename)
 
     request.write("""
@@ -32,7 +31,6 @@
 
 def show_result(pagename, request):
     _ = request.getText
-    request.emit_http_headers()
 
     request.theme.send_title(_("Subscribed for %s:") % pagename, pagename=pagename)
 
--- a/MoinMoin/action/__init__.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/__init__.py	Wed Jun 18 00:28:07 2008 +0200
@@ -269,9 +269,8 @@
 def do_content(pagename, request):
     """ same as do_show, but we only show the content """
     # XXX temporary fix to make it work until Page.send_page gets refactored
-    request.setHttpHeader("Content-Type: text/html; charset=%s" % config.charset)
-    request.setHttpHeader('Status: 200 OK')
-    request.emit_http_headers()
+    request.response.mimetype = 'text/html'
+    request.response.status_code = 200
     do_show(pagename, request, count_hit=0, content_only=1)
 
 def do_print(pagename, request):
--- a/MoinMoin/action/backup.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/backup.py	Wed Jun 18 00:28:07 2008 +0200
@@ -29,9 +29,9 @@
     """ Send compressed tar file """
     dateStamp = time.strftime("%Y-%m-%d--%H-%M-%S-UTC", time.gmtime())
     filename = "%s-%s.tar.%s" % (request.cfg.siteid, dateStamp, request.cfg.backup_compression)
-    request.emit_http_headers([
-        "Content-Type: application/octet-stream",
-        "Content-Disposition: inline; filename=\"%s\"" % filename, ])
+    request.response.content_type = "application/octet-stream"
+    dispo_string = 'inline; filename="%s"' % filename
+    request.response.headers.add('Content-Disposition', dispo_string)
 
     tar = tarfile.open(fileobj=request, mode="w|%s" % request.cfg.backup_compression)
     # allow GNU tar's longer file/pathnames
@@ -71,7 +71,6 @@
 
 def sendBackupForm(request, pagename):
     _ = request.getText
-    request.emit_http_headers()
     request.setContentLanguage(request.lang)
     title = _('Wiki Backup / Restore')
     request.theme.send_title(title, form=request.form, pagename=pagename)
--- a/MoinMoin/action/diff.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/diff.py	Wed Jun 18 00:28:07 2008 +0200
@@ -71,7 +71,6 @@
     # This action generates content in the user language
     request.setContentLanguage(request.lang)
 
-    request.emit_http_headers()
     request.theme.send_title(_('Diff for "%s"') % (pagename, ), pagename=pagename, allow_doubleclick=1)
 
     if rev1 > 0 and rev2 > 0 and rev1 > rev2 or rev1 == 0 and rev2 > 0:
--- a/MoinMoin/action/dumpform.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/dumpform.py	Wed Jun 18 00:28:07 2008 +0200
@@ -12,6 +12,5 @@
     """ dump the form data we received in this request for debugging """
     data = util.dumpFormData(request.form)
 
-    request.emit_http_headers()
     request.write("<html><body>%s</body></html>" % data)
 
--- a/MoinMoin/action/fckdialog.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/fckdialog.py	Wed Jun 18 00:28:07 2008 +0200
@@ -15,7 +15,6 @@
 
 def macro_dialog(request):
     help = get_macro_help(request)
-    request.emit_http_headers()
     request.write(
         '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
@@ -170,7 +169,6 @@
         pages = [p.page_name for p in searchresult.hits]
     else:
         pages = [name]
-    request.emit_http_headers()
     request.write(
         '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
@@ -201,7 +199,6 @@
 ''' % "".join(["<option>%s</option>\n" % p for p in pages]))
 
 def link_dialog(request):
-    request.emit_http_headers()
     # list of wiki pages
     name = request.form.get("pagename", [""])[0]
     if name:
@@ -367,7 +364,6 @@
 ##############################################################################
 
 def attachment_dialog(request):
-    request.emit_http_headers()
     # list of wiki pages
     name = request.form.get("pagename", [""])[0]
     if name:
@@ -461,7 +457,6 @@
 ##############################################################################
 
 def image_dialog(request):
-    request.emit_http_headers()
     url_prefix_static = request.cfg.url_prefix_static
     request.write('''
 <!--
--- a/MoinMoin/action/fullsearch.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/fullsearch.py	Wed Jun 18 00:28:07 2008 +0200
@@ -223,8 +223,6 @@
         Page(request, pagename).send_page()
         return
 
-    request.emit_http_headers()
-
     # This action generates data using the user language
     request.setContentLanguage(request.lang)
 
--- a/MoinMoin/action/info.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/info.py	Wed Jun 18 00:28:07 2008 +0200
@@ -187,8 +187,6 @@
     page = Page(request, pagename)
     title = page.split_title()
 
-    request.emit_http_headers()
-
     request.setContentLanguage(request.lang)
     f = request.formatter
 
--- a/MoinMoin/action/links.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/links.py	Wed Jun 18 00:28:07 2008 +0200
@@ -19,7 +19,7 @@
     else:
         mimetype = "text/html"
 
-    request.emit_http_headers(["Content-Type: %s; charset=%s" % (mimetype, config.charset)])
+    request.response.mimetype = mimetype
 
     if mimetype == "text/html":
         request.theme.send_title(_('Full Link List for "%s"') % request.cfg.sitename)
--- a/MoinMoin/action/login.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/login.py	Wed Jun 18 00:28:07 2008 +0200
@@ -38,7 +38,6 @@
         form.append(html.INPUT(type='hidden', name='stage',
                                value=request._login_multistage_name))
 
-        request.emit_http_headers()
         request.theme.send_title(_("Login"), pagename=self.pagename)
         # Start content (important for RTL support)
         request.write(request.formatter.startContent("content"))
@@ -74,7 +73,6 @@
             return self.page.send_page()
 
         else: # show login form
-            request.emit_http_headers()
             request.theme.send_title(_("Login"), pagename=self.pagename)
             # Start content (important for RTL support)
             request.write(request.formatter.startContent("content"))
--- a/MoinMoin/action/newaccount.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/newaccount.py	Wed Jun 18 00:28:07 2008 +0200
@@ -167,7 +167,6 @@
         request.theme.add_msg(_create_user(request), "dialog")
         return page.send_page()
     else: # show create form
-        request.emit_http_headers()
         request.theme.send_title(_("Create Account"), pagename=pagename)
 
         request.write(request.formatter.startContent("content"))
--- a/MoinMoin/action/pollsistersites.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/pollsistersites.py	Wed Jun 18 00:28:07 2008 +0200
@@ -54,5 +54,5 @@
         except TypeError: # catch bug in python 2.5: "EnvironmentError expected at most 3 arguments, got 4"
             status.append(u"Site: %s Status: Not updated." % sistername)
 
-    request.emit_http_headers(["Content-Type: text/plain; charset=UTF-8"])
+    request.response.mimetype = 'text/plain'
     request.write("\r\n".join(status).encode("utf-8"))
--- a/MoinMoin/action/recoverpass.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/recoverpass.py	Wed Jun 18 00:28:07 2008 +0200
@@ -179,7 +179,6 @@
             return
 
     if token and name:
-        request.emit_http_headers()
         request.theme.send_title(_("Password reset"), pagename=pagename)
 
         request.write(request.formatter.startContent("content"))
@@ -200,7 +199,6 @@
         request.theme.add_msg(msg, "dialog")
         page.send_page()
     else: # show create form
-        request.emit_http_headers()
         request.theme.send_title(_("Lost password"), pagename=pagename)
 
         request.write(request.formatter.startContent("content"))
--- a/MoinMoin/action/rss_rc.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/rss_rc.py	Wed Jun 18 00:28:07 2008 +0200
@@ -24,8 +24,7 @@
     """ Send recent changes as an RSS document
     """
     if not wikixml.ok:
-        httpheaders = ["Content-Type: text/plain; charset=%s" % config.charset]
-        request.emit_http_headers(httpheaders)
+        request.response.mimetype = 'text/plain'
         request.write("rss_rc action is not supported because of missing pyxml module.")
         return
 
@@ -86,28 +85,26 @@
     if request.if_modified_since == timestamp:
         if request.if_none_match:
             if request.if_none_match == etag:
-                request.emit_http_headers(["Status: 304 Not modified"])
+                request.response.status_code = 304
         else:
-            request.emit_http_headers(["Status: 304 Not modified"])
+            request.response.status_code = 304
     elif request.if_none_match == etag:
         if request.if_modified_since:
             if request.if_modified_since == timestamp:
-                request.emit_http_headers(["Status: 304 Not modified"])
+                request.response.status_code = 304
         else:
-            request.emit_http_headers(["Status: 304 Not modified"])
+            request.response.status_code = 304
     else:
         # generate an Expires header, using whatever setting the admin
         # defined for suggested cache lifetime of the RecentChanges RSS doc
-        expires = timefuncs.formathttpdate(time.time() + cfg.rss_cache)
+        expires = time.time() + cfg.rss_cache
 
-        httpheaders = ["Content-Type: text/xml; charset=%s" % config.charset,
-                       "Expires: %s" % expires,
-                       "Last-Modified: %s" % timestamp,
-                       "Etag: %s" % etag, ]
+        request.response.mime_type = 'text/xml'
+        request.response.expires = expires
+        request.response.last_modified = lastmod
+        request.response.headers.add('Etag', etag)
 
         # send the generated XML document
-        request.emit_http_headers(httpheaders)
-
         baseurl = request.getBaseURL()
         if not baseurl.endswith('/'):
             baseurl += '/'
--- a/MoinMoin/action/serveopenid.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/serveopenid.py	Wed Jun 18 00:28:07 2008 +0200
@@ -31,9 +31,8 @@
 
     def serveYadisEP(self, endpoint_url):
         request = self.request
-        hdrs = ['Content-type: application/xrds+xml']
+        request.response.content_type = 'application/xrds+xml'
 
-        request.emit_http_headers(hdrs)
         user_url = request.getQualifiedURL(request.page.url(request))
         self.request.write("""\
 <?xml version="1.0" encoding="UTF-8"?>
@@ -79,9 +78,8 @@
 
     def serveYadisIDP(self, endpoint_url):
         request = self.request
-        hdrs = ['Content-type: application/xrds+xml']
+        request.response.content_type = 'application/xrds+xml'
 
-        request.emit_http_headers(hdrs)
         user_url = request.getQualifiedURL(request.page.url(request))
         self.request.write("""\
 <?xml version="1.0" encoding="UTF-8"?>
@@ -249,10 +247,9 @@
             else:
                 answer = openidsrv.handleRequest(openidreq)
         webanswer = openidsrv.encodeResponse(answer)
-        headers = ['Status: %d OpenID status' % webanswer.code]
+        request.response.status = '%d OpenID status' % webanswer.code
         for hdr in webanswer.headers:
-            headers += [hdr+': '+webanswer.headers[hdr]]
-        request.emit_http_headers(headers)
+            request.response.headers.add(hdr, webanswer.headers[hdr])
         request.write(webanswer.body)
         raise MoinMoinFinish
 
@@ -324,7 +321,6 @@
 Once you have logged in, simply reload this page.'''))
             return
 
-        request.emit_http_headers()
         request.theme.send_title(_("OpenID Trust verification"), pagename=request.page.page_name)
         # Start content (important for RTL support)
         request.write(request.formatter.startContent("content"))
@@ -397,7 +393,6 @@
         request = self.request
         _ = self._
 
-        request.emit_http_headers()
         request.theme.send_title(_("OpenID not served"), pagename=request.page.page_name)
         # Start content (important for RTL support)
         request.write(request.formatter.startContent("content"))
--- a/MoinMoin/action/showtags.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/showtags.py	Wed Jun 18 00:28:07 2008 +0200
@@ -13,9 +13,7 @@
 from MoinMoin.wikisync import TagStore
 
 def execute(pagename, request):
-    mimetype = "text/plain"
-
-    request.emit_http_headers(["Content-Type: %s; charset=%s" % (mimetype, config.charset)])
+    request.response.mimetype = "text/plain"
 
     page = Page(request, pagename)
     tags = TagStore(page)
--- a/MoinMoin/action/sisterpages.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/sisterpages.py	Wed Jun 18 00:28:07 2008 +0200
@@ -32,27 +32,25 @@
     if request.if_modified_since == timestamp:
         if request.if_none_match:
             if request.if_none_match == etag:
-                request.emit_http_headers(["Status: 304 Not modified"])
+                request.response.status_code = 304
         else:
-            request.emit_http_headers(["Status: 304 Not modified"])
+            request.response.status_code = 304
     elif request.if_none_match == etag:
         if request.if_modified_since:
             if request.if_modified_since == timestamp:
-                request.emit_http_headers(["Status: 304 Not modified"])
+                request.response.status_code = 304
         else:
-            request.emit_http_headers(["Status: 304 Not modified"])
+            request.response.status_code = 304
     else:
         # generate an Expires header, using 1d cache lifetime of sisterpages list
-        expires = timefuncs.formathttpdate(time.time() + 24*3600)
+        expires = time.time() + 24*3600
 
-        httpheaders = ["Content-Type: text/plain; charset=UTF-8",
-                       "Expires: %s" % expires,
-                       "Last-Modified: %s" % timestamp,
-                       "Etag: %s" % etag, ]
+        request.response.mime_type = 'text/plain'
+        request.response.expires = expires
+        request.response.last_modified = timestamp
+        request.response.headers.add("Etag", etag)
 
         # send the generated XML document
-        request.emit_http_headers(httpheaders)
-
         baseurl = request.getBaseURL()
         if not baseurl.endswith('/'):
             baseurl += '/'
--- a/MoinMoin/action/sitemap.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/sitemap.py	Wed Jun 18 00:28:07 2008 +0200
@@ -64,7 +64,7 @@
     request.user.datetime_fmt = datetime_fmt
     base = request.getBaseURL()
 
-    request.emit_http_headers(["Content-Type: text/xml; charset=UTF-8"])
+    request.response.mimetype ='text/xml'
 
     # we emit a piece of data so other side doesn't get bored:
     request.write("""<?xml version="1.0" encoding="UTF-8"?>\r\n""")
--- a/MoinMoin/action/thread_monitor.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/thread_monitor.py	Wed Jun 18 00:28:07 2008 +0200
@@ -33,7 +33,6 @@
     else:
         dump_fname = "nowhere"
 
-    request.emit_http_headers()
     request.write('<html><body>A dump has been saved to %s.</body></html>' % dump_fname)
 
 def execute_wiki(pagename, request):
@@ -44,8 +43,6 @@
         request.theme.add_msg(_('You are not allowed to use this action.'), "error")
         return Page.Page(request, pagename).send_page()
 
-    request.emit_http_headers()
-
     request.theme.send_title("Thread monitor")
     request.write('<pre>')
 
--- a/MoinMoin/action/titleindex.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/titleindex.py	Wed Jun 18 00:28:07 2008 +0200
@@ -21,8 +21,7 @@
         mimetype = form['mimetype'][0]
     else:
         mimetype = "text/plain"
-
-    request.emit_http_headers(["Content-Type: %s; charset=%s" % (mimetype, config.charset)])
+    request.response.mimetype = mimetype
 
     # Get list of user readable pages
     pages = request.rootpage.getPageList()
--- a/MoinMoin/action/userprefs.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/action/userprefs.py	Wed Jun 18 00:28:07 2008 +0200
@@ -101,7 +101,6 @@
         title = _("Settings") + ":" + title
     else:
         title = _("Settings")
-    request.emit_http_headers()
     request.theme.add_msg(msg, msg_class)
     request.theme.send_title(title, page=request.page, pagename=pagename)
     # Start content (important for RTL support)
--- a/MoinMoin/stats/hitcounts.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/stats/hitcounts.py	Wed Jun 18 00:28:07 2008 +0200
@@ -252,11 +252,8 @@
         (request.cfg.chart_options['width'], request.cfg.chart_options['height']),
         image, days)
 
-    headers = [
-        "Content-Type: image/gif",
-        "Content-Length: %d" % len(image.getvalue()),
-    ]
-    request.emit_http_headers(headers)
+    request.response.content_type = 'image/gif'
+    request.response.content_length = len(image.getvalue())
 
     # copy the image
     image.reset()
--- a/MoinMoin/stats/pagesize.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/stats/pagesize.py	Wed Jun 18 00:28:07 2008 +0200
@@ -113,11 +113,8 @@
         (request.cfg.chart_options['width'], request.cfg.chart_options['height']),
         image, labels)
 
-    headers = [
-        "Content-Type: image/gif",
-        "Content-Length: %d" % len(image.getvalue()),
-    ]
-    request.emit_http_headers(headers)
+    request.response.content_type = 'image/gif'
+    request.response.content_length = len(image.getvalue())
 
     # copy the image
     image.reset()
--- a/MoinMoin/stats/useragents.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/stats/useragents.py	Wed Jun 18 00:28:07 2008 +0200
@@ -173,11 +173,8 @@
         (request.cfg.chart_options['width'], request.cfg.chart_options['height']),
         image, labels)
 
-    headers = [
-        "Content-Type: image/gif",
-        "Content-Length: %d" % len(image.getvalue()),
-    ]
-    request.emit_http_headers(headers)
+    request.response.content_type = 'image/gif'
+    request.response.content_length = len(image.getvalue())
 
     # copy the image
     image.reset()
--- a/MoinMoin/xmlrpc/__init__.py	Tue Jun 17 18:36:56 2008 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Wed Jun 18 00:28:07 2008 +0200
@@ -166,10 +166,8 @@
                 # serialize it
                 response = xmlrpclib.dumps(response, methodresponse=1)
 
-        self.request.emit_http_headers([
-            "Content-Type: text/xml; charset=utf-8",
-            "Content-Length: %d" % len(response),
-        ])
+        self.request.response.content_type = 'text/xml'
+        self.request.response.content_length = len(response)
         self.request.write(response)
 
     def dispatch(self, method, params):