method = getattr(target_class,results['action'])
except:
# Si erreur pendant la recherche, on renvoie un 501
- start_response("501 Not Implemented", [('Content-type', 'text/html')])
+ start_response("501 Not Implemented", [('Content-type', 'text/html; charset=utf-8')])
return '<html><body><h2>501 objet ou action invalide</h2></body></html>' # <pre>%s: %s\n%s</pre></body></html>' % ( sys.exc_info()[0] , sys.exc_info()[1] , traceback.format_exc())
try:
# On lance la méthode et on renvoie le résultat
type, output = method(target_class(environ))
- start_response("200 OK", [('Content-type', formats[type])])
+ start_response("200 OK", [('Content-type', formats[type] + "; charset=utf-8")])
return output.encode('utf-8')
# gestion des problèmes possibles pendant l'exécution
except ObjetInconnu, type:
- start_response("404 Not Found", [('Content-type', 'text/html')])
+ start_response("404 Not Found", [('Content-type', 'text/html; charset=utf-8')])
return '<html><body><h2>404 %s inexistant</h2></body></html>' % type
except TemplateNotFound, template:
- start_response("415 Unsupported Media Type", [('Content-type', 'text/html')])
+ start_response("415 Unsupported Media Type", [('Content-type', 'text/html; charset=utf-8')])
return '<html><body><h2>415 format non supporté (%s inexistant)</h2></body></html>' % template
except:
- start_response("500 INTERNAL ERROR", [('Content-type', 'text/html')])
+ start_response("500 INTERNAL ERROR", [('Content-type', 'text/html; charset=utf-8')])
return '<html><body><h2>500 erreur lors du traitement</h2><pre>%s: %s\n%s</pre></body></html>' % ( sys.exc_info()[0] , sys.exc_info()[1] , traceback.format_exc())