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

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/browser/__init__.py

mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
from ivle.webapp.base.plugins import ViewPlugin, CookiePlugin, MediaPlugin
30
30
from ivle.webapp.base.xhtml import XHTMLView
 
31
from ivle.webapp.errors import NotFound
31
32
 
32
33
import os.path
33
34
import cgi
34
35
 
35
 
from ivle import (util, studpath)
 
36
from ivle import studpath
36
37
import ivle.svn
37
38
 
38
39
class BrowserView(XHTMLView):
49
50
    def populate(self, req, ctx):
50
51
        if not hasattr(self, 'path'):
51
52
            # If no path specified, default to the user's home directory
52
 
            redirectPath = util.make_path(os.path.join('files', req.user.login))
53
 
            req.throw_redirect(util.make_path(redirectPath))
 
53
            redirectPath = req.make_path(os.path.join('files', req.user.login))
 
54
            req.throw_redirect(redirectPath)
54
55
 
55
56
        # Set request attributes
56
57
        self.plugin_styles[Plugin] = ['browser.css',
87
88
        # The page title should contain the name of the file being browsed
88
89
        ctx['title'] = self.path.rsplit('/', 1)[-1]
89
90
 
90
 
        ctx['fileservice_action'] = util.make_path(os.path.join("fileservice",
 
91
        ctx['fileservice_action'] = req.make_path(os.path.join("fileservice",
91
92
                                                                self.path))
92
93
        ctx['filename'] = cgi.escape(self.path)
93
94
 
94
95
    #TODO: Move all this logic into the template
95
96
    def gen_path(self, req, ctx):
96
97
 
97
 
        href_path = util.make_path('files')
 
98
        href_path = req.make_path('files')
98
99
        nav_path = ""
99
100
        revision = ivle.svn.revision_from_string(
100
101
                         req.get_fieldstorage().getfirst('r'))