~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-25 03:18:21 UTC
  • Revision ID: grantw@unimelb.edu.au-20100225031821-mi9a2tm5679fht4d
Shuffle things around so that req.user and req.store only construct when actually retrieved, and ensure they're not retrieved for media files. Saves 50ms of DB connection time per request.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
            return os.path.join(plugindir, mediadir, self.path)
95
95
 
96
96
class MediaFileView(BaseView):
97
 
    permission = None
 
97
    def authorize(self, req):
 
98
        return True
98
99
 
99
100
    def render(self, req):
100
101
        # If it begins with ".." or separator, it's illegal. Die.
130
131
    def get_filename(self, req):
131
132
        return self.context.filename
132
133
 
133
 
    def get_permissions(self, user, config):
134
 
        return set()
135
 
 
136
134
def root_to_media(root, *segments):
137
135
    if segments[0].startswith('+'):
138
136
        if segments[0] == '+external':