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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2009-05-19 02:54:08 UTC
  • mfrom: (1258 trunk)
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: matt.giuca@gmail.com-20090519025408-19c7cjl7w6ot6frm
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import cjson
23
23
import pysvn
24
24
 
25
 
import ivle.conf
26
25
import ivle.date
27
26
import ivle.interpret
28
27
from ivle.webapp.base.xhtml import XHTMLView
29
28
from ivle.webapp.base.plugins import ViewPlugin, MediaPlugin
30
29
from ivle.webapp.errors import NotFound, BadRequest
 
30
from ivle.webapp.filesystem import make_path_segments
31
31
 
32
32
class SubversionLogView(XHTMLView):
33
33
    template = 'template.html'
 
34
    tab = 'files'
34
35
 
35
36
    def authorize(self, req):
36
37
        return req.user is not None
38
39
    def populate(self, req, ctx):
39
40
        self.plugin_styles[Plugin] = ['log.css']
40
41
 
41
 
        svnlogservice_path = os.path.join(ivle.conf.share_path,
 
42
        svnlogservice_path = os.path.join(req.config['paths']['share'],
42
43
                                          'services/svnlogservice')
43
44
 
44
 
        user_jail_dir = os.path.join(ivle.conf.jail_base, req.user.login)
 
45
        user_jail_dir = os.path.join(req.config['paths']['jails']['mounts'],
 
46
                                     req.user.login)
45
47
        (out, err) = ivle.interpret.execute_raw(req.user, user_jail_dir,
46
48
                             '/home', svnlogservice_path, [self.path])
47
49
        assert not err
56
58
 
57
59
        # No error. We must be safe.
58
60
        ctx['path'] = self.path
59
 
        ctx['url'] = ivle.util.make_path(os.path.join('svnlog', self.path))
 
61
        ctx['url'] = req.make_path(os.path.join('svnlog', self.path))
 
62
        ctx['diffurl'] = req.make_path(os.path.join('diff', self.path))
 
63
        ctx['title'] = self.path.rsplit('/', 1)[-1]
 
64
        ctx['paths'] = make_path_segments(self.path)
60
65
 
61
66
        sr = ivle.svn.revision_from_string(
62
67
                   req.get_fieldstorage().getfirst("r"))
69
74
        for log in ctx['logs']:
70
75
            log['date'] = ivle.date.make_date_nice(log['date'])
71
76
            for pathaction in log['paths']:
72
 
                pathaction.append(ivle.util.make_path(os.path.join('files',
 
77
                pathaction.append(req.make_path(os.path.join('files',
73
78
                                  ivle.util.split_path(req.path)[0],
74
79
                                  pathaction[0][1:])) + '?r=%d' % log['revno'])
75
80