Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 694

Show
Ignore:
Timestamp:
09/30/05 00:37:06
Author:
fumanchu
Message:

Fix for ticket #310. Thanks to UnionPivo? for the patch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cputil.py

    r692 r694  
    3434import traceback 
    3535import time 
     36import cgi 
    3637 
    3738import cherrypy 
     
    152153 
    153154 
    154 _HTTPErrorTemplate = '''<?xml version="1.0" encoding="UTF-8"?> 
    155 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     155_HTTPErrorTemplate = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    156156  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    157157<html> 
    158158<head> 
     159    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    159160    <title>%(status)s</title> 
    160161    <style type="text/css"> 
     
    203204        if v is None: 
    204205            kwargs[k] = "" 
     206        else: 
     207            kwargs[k] = cgi.escape(kwargs[k]) 
    205208     
    206209    template = _HTTPErrorTemplate 
  • trunk/cherrypy/test/test_core.py

    r693 r694  
    163163     
    164164    def custom(self): 
    165         raise cherrypy.HTTPError(404
     165        raise cherrypy.HTTPError(404, "No, <b>really</b>, not found!"
    166166     
    167167    def page_method(self): 
     
    541541         
    542542        # Test error in custom error page (ticket #305). 
     543        # Note that the message is escaped for HTML (ticket #310). 
    543544        self.getPage("/error/custom") 
    544545        self.assertStatus("404 Not Found") 
    545         msg = ("Nothing matches the given URI<br />" 
     546        msg = ("No, &lt;b&gt;really&lt;/b&gt;, not found!<br />" 
    546547               "In addition, the custom error page failed:\n<br />" 
    547548               "[Errno 2] No such file or directory: 'nonexistent.html'") 

Hosted by WebFaction

Log in as guest/cpguest to create tickets