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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2009-12-10 09:47:38 UTC
  • Revision ID: grantw@unimelb.edu.au-20091210094738-pa4yrieyb9ynigej
Clean up and correct the admin scripts documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    """
22
22
    Abstract base class for all view objects.
23
23
    """
24
 
    def __init__(self, req, **kwargs):
25
 
        pass
 
24
 
 
25
    subpath_allowed = False
 
26
 
 
27
    def __init__(self, req, context, subpath=None):
 
28
        self.context = context
 
29
        if self.subpath_allowed:
 
30
            self.subpath = subpath
 
31
 
26
32
    def render(self, req):
27
 
        pass
 
33
        raise NotImplementedError()
 
34
 
 
35
    def get_permissions(self, user):
 
36
        return self.context.get_permissions(user)
 
37
 
 
38
    def authorize(self, req):
 
39
        self.perms = self.get_permissions(req.user)
 
40
 
 
41
        return self.permission is None or self.permission in self.perms