Mercurial > public > src > rhodecode
changeset 879:f579790a0ecd beta
spelling fixes for error controller
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 08 Dec 2010 18:43:35 +0100 |
parents | 2ef22ee3b45a |
children | 81e8dfa3beb5 |
files | rhodecode/controllers/error.py |
diffstat | 1 files changed, 40 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/error.py Tue Dec 07 18:45:57 2010 +0100 +++ b/rhodecode/controllers/error.py Wed Dec 08 18:43:35 2010 +0100 @@ -1,33 +1,58 @@ -import logging +# -*- coding: utf-8 -*- +""" + package.rhodecode.controllers.error + ~~~~~~~~~~~~~~ + + RhodeCode error controller + + :created_on: Dec 8, 2010 + :author: marcink + :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> + :license: GPLv3, see COPYING for more details. +""" +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 2 +# of the License or (at your opinion) any later version of the license. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +import os import cgi -import os +import logging import paste.fileapp -from pylons import tmpl_context as c, app_globals as g, request, config -from pylons.controllers.util import forward + +from pylons import tmpl_context as c, request from pylons.i18n.translation import _ +from pylons.middleware import media_path + from rhodecode.lib.base import BaseController, render -from pylons.middleware import media_path -from rhodecode.lib.utils import check_repo -import rhodecode.lib.helpers as h -from rhodecode import __version__ + log = logging.getLogger(__name__) class ErrorController(BaseController): - """ - Generates error documents as and when they are required. + """Generates error documents as and when they are required. The ErrorDocuments middleware forwards to ErrorController when error related status codes are returned from the application. - This behaviour can be altered by changing the parameters to the + This behavior can be altered by changing the parameters to the ErrorDocuments middleware in your config/middleware.py file. """ + def __before__(self): pass#disable all base actions since we don't need them here - + def document(self): resp = request.environ.get('pylons.original_response') - + log.debug('### %s ###', resp.status) e = request.environ @@ -36,7 +61,7 @@ 'host':e.get('HTTP_HOST'), } - + c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) c.error_explanation = self.get_error_explanation(resp.status_int) @@ -74,7 +99,7 @@ if code == 400: return _('The request could not be understood by the server due to malformed syntax.') if code == 401: - return _('Unathorized access to resource') + return _('Unauthorized access to resource') if code == 403: return _("You don't have permission to view this page") if code == 404: