Commits

Ben Bangert committed 901da25

Handle verbose body element

Comments (0)

Files changed (1)

            response.headers['content-type'].startswith('text/html'):
             logbar = self.render('/logbar.mako', events=reqlogs, 
                                  logcolors = self.log_colors, tottime=tottime)
-            response.body = response.body.replace('<body>',
-                                                  '<body>%s' % logbar)
+            response.body = re.sub(r'<body([^>]*)>', r'<body\1>%s' % logbar, response.body)
         return response(environ, start_response)
 
     def render(self, name, **vars):