~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/error_ui.py

  • Committer: Alexandre Garnier
  • Date: 2009-05-30 17:40:05 UTC
  • mto: This revision was merged to the branch mainline in revision 358.
  • Revision ID: zigouigoui.garnier@laposte.net-20090530174005-h4dztserbvrjaw5f
Corrections on bugs info display
 - CSS corrections
 - change order with revision info
 - correct URL in href

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright (C) 2008  Guillermo Gonzalez <guillo.gonzo@gmail.com>
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2 of the License, or
 
7
# (at your option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
#
 
18
 
 
19
from StringIO import StringIO
 
20
import traceback
 
21
 
 
22
from loggerhead.controllers import TemplatedBranchView
 
23
from loggerhead import util
 
24
 
 
25
 
 
26
class ErrorUI(TemplatedBranchView):
 
27
 
 
28
    template_path = 'loggerhead.templates.error'
 
29
 
 
30
    def __init__(self, branch, exc_info):
 
31
        super(ErrorUI, self).__init__(branch, lambda:None)
 
32
        self.exc_info = exc_info
 
33
 
 
34
    def get_values(self, path, kwargs, response):
 
35
        exc_type, exc_object, exc_tb = self.exc_info
 
36
        description = StringIO()
 
37
        traceback.print_exception(exc_type, exc_object, None, file=description)
 
38
        directory_breadcrumbs = (
 
39
            util.directory_breadcrumbs(
 
40
                self._branch.friendly_name,
 
41
                self._branch.is_root,
 
42
                'changes'))
 
43
        return {
 
44
            'branch': self._branch,
 
45
            'error_title': ('An unexpected error occurred while'
 
46
                            'proccesing the request:'),
 
47
            'error_description': description.getvalue(),
 
48
            'directory_breadcrumbs': directory_breadcrumbs,
 
49
        }