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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2009-06-29 06:43:20 UTC
  • Revision ID: grantw@unimelb.edu.au-20090629064320-vrahlocbh0d5852w
Allow admins to set the admin flag with ivle-adduser (issue #151).

ivle-makeuser was also renamed to ivle-adduser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from ivle.webapp.base.views import BaseView
29
29
from ivle.webapp.base.plugins import ViewPlugin, OverlayPlugin
30
30
from ivle.webapp.errors import HTTPError, Unauthorized
31
 
from ivle.webapp.routing import NoPath
32
31
 
33
32
class XHTMLView(BaseView):
34
33
    """
46
45
    allow_overlays = True
47
46
    overlay_blacklist = []
48
47
 
 
48
    def __init__(self, req, **kwargs):
 
49
        for key in kwargs:
 
50
            setattr(self, key, kwargs[key])
 
51
 
49
52
    def filter(self, stream, ctx):
50
53
        return stream
51
54
 
93
96
        ctx['scripts_init'] = self.scripts_init + overlay_bits[3]
94
97
        ctx['app_template'] = app
95
98
        ctx['title_img'] = media_url(req, CorePlugin,
96
 
                                     "images/chrome/root-breadcrumb.png")
97
 
        try:
98
 
            ctx['ancestry'] = req.router.get_ancestors(self.context)
99
 
        except NoPath:
100
 
            ctx['ancestry'] = []
101
 
        ctx['breadcrumb_text'] = lambda x: x # TODO: Do it properly.
102
 
        ctx['url'] = req.router.generate
 
99
                                     "images/chrome/title.png")
103
100
        self.populate_headings(req, ctx)
104
101
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
105
102
                                                        'ivle-headings.html'))
196
193
class XHTMLErrorView(XHTMLView):
197
194
    template = 'xhtmlerror.html'
198
195
 
 
196
    def __init__(self, req, exception):
 
197
        self.context = exception
 
198
 
199
199
    def populate(self, req, ctx):
200
 
        ctx['req'] = req
201
200
        ctx['exception'] = self.context
202
201
 
203
202
class XHTMLUnauthorizedView(XHTMLErrorView):