~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/error_ui.py

  • Committer: John Arbash Meinel
  • Date: 2011-03-14 15:01:47 UTC
  • mto: This revision was merged to the branch mainline in revision 439.
  • Revision ID: john@arbash-meinel.com-20110314150147-70edfc2pkb557d2b
Add a test at the 'view' level, that we don't access too much history.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from loggerhead.controllers import TemplatedBranchView
23
23
from loggerhead import util
24
24
 
 
25
 
25
26
class ErrorUI(TemplatedBranchView):
26
27
 
27
28
    template_path = 'loggerhead.templates.error'
28
29
 
29
30
    def __init__(self, branch, exc_info):
30
 
        super(ErrorUI, self).__init__(branch, None)
 
31
        super(ErrorUI, self).__init__(branch, lambda: None)
31
32
        self.exc_info = exc_info
32
33
 
33
 
    def get_values(self, h, args, kw, headers):
 
34
    def get_values(self, path, kwargs, response):
34
35
        exc_type, exc_object, exc_tb = self.exc_info
35
36
        description = StringIO()
36
37
        traceback.print_exception(exc_type, exc_object, None, file=description)
37
 
        directory_breadcrumbs = (
38
 
            util.directory_breadcrumbs(
39
 
                self._branch.friendly_name,
40
 
                self._branch.is_root,
41
 
                'changes'))
 
38
        directory_breadcrumbs = util.directory_breadcrumbs(
 
39
            self._branch.friendly_name, self._branch.is_root, 'changes')
42
40
        return {
43
41
            'branch': self._branch,
44
 
            'error_title': 'An unexpected error occurred while proccesing the request:',
 
42
            'error_title': ('An unexpected error occurred while'
 
43
                            'processing the request:'),
45
44
            'error_description': description.getvalue(),
46
45
            'directory_breadcrumbs': directory_breadcrumbs,
47
46
        }