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

« back to all changes in this revision

Viewing changes to ivle/webapp/media.py

  • Committer: William Grant
  • Date: 2010-02-15 03:15:54 UTC
  • Revision ID: grantw@unimelb.edu.au-20100215031554-jtx6yn9se091v4rf
Clarify that you actually need two project sets: one for solo, one for group.

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 PublicViewPlugin, ViewPlugin, MediaPlugin
30
30
from ivle.webapp.errors import NotFound, Forbidden
31
 
from ivle.webapp.routing import INF
 
31
from ivle.webapp.publisher import INF
32
32
from ivle.webapp import ApplicationRoot
33
33
 
34
34
# This maps a media namespace to an external dependency directory (in this
102
102
           self.context.path.startswith('/'):
103
103
            raise Forbidden()
104
104
 
105
 
        filename = self.context.filename
 
105
        filename = self.get_filename(req)
106
106
        if filename is None:
107
107
            raise NotFound()
108
108
 
127
127
        req.content_type = type
128
128
        req.sendfile(filename)
129
129
 
130
 
    def get_permissions(self, user):
 
130
    def get_filename(self, req):
 
131
        return self.context.filename
 
132
 
 
133
    def get_permissions(self, user, config):
131
134
        return set()
132
135
 
133
136
def root_to_media(root, *segments):
160
163
class Plugin(ViewPlugin, PublicViewPlugin):
161
164
    forward_routes = [(ApplicationRoot, '+media', root_to_media, INF)]
162
165
    views = [(MediaFile, '+index', MediaFileView)]
 
166
    public_forward_routes = forward_routes
 
167
    public_views = views