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

« back to all changes in this revision

Viewing changes to ivle/webapp/media.py

Added overlay system and console overlay. Note that the console overlay
is no longer special cased, allowing multiple overlays per page.

This commit breaks the original console tab.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from ivle.webapp.errors import NotFound
30
30
 
31
31
def media_url(req, plugin, path):
32
 
    '''Generates a URL to a media file.'''
33
 
    return os.path.join(ivle.conf.root_dir, '+media',
34
 
                        req.reverse_plugins[plugin], path)
 
32
    '''Generates a URL to a media file.
 
33
    
 
34
    Plugin can be a string, in which case it is put into the path literally,
 
35
    or a plugin object, in which case its name is looked up.'''
 
36
    if not isinstance(plugin, basestring):
 
37
        plugin = req.reverse_plugins[plugin]
 
38
        
 
39
    return os.path.join(ivle.conf.root_dir, '+media', plugin, path)
35
40
 
36
41
class MediaFileView(BaseView):
37
42
    '''A view for media files.