~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/xhtml.py

Add support for custom error views. Plugins can now declare that errors
occuring in a view class or its subclasses should be passed into another view.

We start with an XHTMLErrorView used to render errors in XHTMLViews.

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
                for mplugin in overlay.plugin_styles:
137
137
                    for path in overlay.plugin_styles[mplugin]:
138
138
                        req.styles.append(media_url(req, mplugin, path))
139
 
                
 
139
 
140
140
                req.scripts_init += overlay.plugin_scripts_init
141
 
                
 
141
 
142
142
                overlays.append(overlay.render(req))
143
143
        return overlays
 
144
 
 
145
class XHTMLErrorView(XHTMLView):
 
146
    template = 'xhtmlerror.html'
 
147
 
 
148
    def __init__(self, req, exception):
 
149
        self.context = exception
 
150
 
 
151
    def populate(self, req, ctx):
 
152
        ctx['exception'] = self.context