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

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject.py

  • Committer: Matt Giuca
  • Date: 2010-03-05 07:03:27 UTC
  • Revision ID: matt.giuca@gmail.com-20100305070327-nj2bs3owz1kngkmy
ivle.webapp.admin.subject: Abstracted code to generate Subversion URL into the database. User and ProjectGroup objects now have a get_svn_url method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
738
738
    def build_subversion_url(self, config, submission):
739
739
        princ = submission.assessed.principal
740
740
 
741
 
        if isinstance(princ, User):
742
 
            path = 'users/%s' % princ.login
743
 
        else:
744
 
            path = 'groups/%s_%s_%s_%s' % (
745
 
                    princ.project_set.offering.subject.short_name,
746
 
                    princ.project_set.offering.semester.year,
747
 
                    princ.project_set.offering.semester.semester,
748
 
                    princ.name
749
 
                    )
750
 
        return urlparse.urljoin(
751
 
                    config['urls']['svn_addr'],
752
 
                    os.path.join(path, submission.path[1:] if
753
 
                                       submission.path.startswith(os.sep) else
754
 
                                       submission.path))
 
741
        return os.path.join(princ.get_svn_url(config),
 
742
                            submission.path[1:] if
 
743
                                submission.path.startswith(os.sep) else
 
744
                                submission.path)
755
745
 
756
746
    def populate(self, req, ctx):
757
747
        self.plugin_styles[Plugin] = ["project.css"]