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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: William Grant
  • Date: 2009-01-19 04:18:20 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090119041820-z6t1a5tmpfzcf6ny
ivle.makeuser: Port rebuild_svn_group_config() to Storm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
import ivle.db
49
49
import ivle.pulldown_subj
50
50
 
 
51
from ivle.database import ProjectGroup
 
52
 
51
53
def chown_to_webserver(filename):
52
54
    """
53
55
    Chowns a file so the web server user owns it.
105
107
def rebuild_svn_group_config(store):
106
108
    """Build the complete SVN configuration file for groups
107
109
    """
108
 
    conn = ivle.db.DB()
109
 
    groups = conn.get_all('project_group',
110
 
        ['groupid', 'groupnm', 'projectsetid'])
111
110
    f = open(ivle.conf.svn_group_conf + ".new", "w")
112
111
    f.write("# IVLE SVN Group Repositories Configuration\n")
113
112
    f.write("# Auto-generated on %s\n" % time.asctime())
114
113
    f.write("\n")
115
 
    for g in groups:
116
 
        projectsetid = g['projectsetid']
117
 
        offeringinfo = conn.get_offering_info(projectsetid)
118
 
        subj_short_name = offeringinfo['subj_short_name']
119
 
        year = offeringinfo['year']
120
 
        semester = offeringinfo['semester']
121
 
        reponame = "_".join([subj_short_name, year, semester, g['groupnm']])
 
114
    for group in store.find(ProjectGroup):
 
115
        offering = group.project_set.offering
 
116
        reponame = "_".join([offering.subject.short_name,
 
117
                             offering.semester.year,
 
118
                             offering.semester.semester,
 
119
                             group.name])
122
120
        f.write("[%s:/]\n"%reponame)
123
 
        users = conn.get_projectgroup_members(g['groupid'])
124
 
        for u in users:
125
 
            f.write("%s = rw\n"%u['login'])
 
121
        for user in group.members:
 
122
            f.write("%s = rw\n" % user.login)
126
123
        f.write("\n")
127
124
    f.close()
128
125
    os.rename(ivle.conf.svn_group_conf + ".new", ivle.conf.svn_group_conf)