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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: William Grant
  • Date: 2009-12-08 03:50:24 UTC
  • mfrom: (1294.2.143 ui-the-third)
  • Revision ID: grantw@unimelb.edu.au-20091208035024-wjx8zp54gth15ph8
Merge ui-the-third. This is another UI revamp.

The header is now thin! Thin! The yellow bar is gone. The tabs are gone.
Breadcrumbs are here. Routes is replaced (with an object publishing
mechanism). Views are less repetitive. etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        f.write("""
73
73
[%(login)s:/]
74
74
%(login)s = rw
75
 
""" % {'login': u.login.encode('utf-8')})
 
75
""" % {'login': u.login})
76
76
 
77
77
    # Now we need to grant offering tutors and lecturers access to the latest
78
78
    # submissions in their offerings. There are much prettier ways to do this,
102
102
                    User.login,
103
103
                    User.id == Enrolment.user_id,
104
104
                    Enrolment.offering_id == offeringid,
105
 
                    Enrolment.role.is_in((u'tutor', u'lecturer')),
106
 
                    Enrolment.active == True,
 
105
                    Enrolment.role.is_in((u'tutor', u'lecturer'))
107
106
                )
108
107
            )
109
108
 
110
109
        f.write("""
111
110
# Submission %(id)d
112
111
[%(login)s:%(path)s]
113
 
""" % {'login': login.encode('utf-8'), 'id': psid,
114
 
       'path': pspath.encode('utf-8')})
 
112
""" % {'login': login, 'id': psid, 'path': pspath})
115
113
 
116
114
        for viewer_login in offering_viewers_cache[offeringid]:
117
115
            # We don't want to override the owner's write privilege,
118
116
            # so we don't add them to the read-only ACL.
119
117
            if login != viewer_login:
120
 
                f.write("%s = r\n" % viewer_login.encode('utf-8'))
 
118
                f.write("%s = r\n" % viewer_login)
121
119
 
122
120
    f.close()
123
121
    os.rename(temp_name, conf_name)
146
144
                             offering.semester.semester,
147
145
                             group.name])
148
146
 
149
 
        f.write("[%s:/]\n" % reponame.encode('utf-8'))
 
147
        f.write("[%s:/]\n" % reponame)
150
148
        if group.id not in group_members_cache:
151
149
            group_members_cache[group.id] = set()
152
150
        for user in group.members:
153
151
            group_members_cache[group.id].add(user.login)
154
 
            f.write("%s = rw\n" % user.login.encode('utf-8'))
 
152
            f.write("%s = rw\n" % user.login)
155
153
        f.write("\n")
156
154
 
157
155
    # Now we need to grant offering tutors and lecturers access to the latest
187
185
                    User.login,
188
186
                    User.id == Enrolment.user_id,
189
187
                    Enrolment.offering_id == offeringid,
190
 
                    Enrolment.role.is_in((u'tutor', u'lecturer')),
191
 
                    Enrolment.active == True,
 
188
                    Enrolment.role.is_in((u'tutor', u'lecturer'))
192
189
                )
193
190
            )
194
191
 
195
192
        f.write("""
196
193
# Submission %(id)d
197
194
[%(repo)s:%(path)s]
198
 
""" % {'repo': reponame.encode('utf-8'), 'id': psid,
199
 
       'path': pspath.encode('utf-8')})
 
195
""" % {'repo': reponame, 'id': psid, 'path': pspath})
200
196
 
201
197
        for viewer_login in offering_viewers_cache[offeringid]:
202
198
            # Skip existing group members, or they can't write to it any more.
273
269
        # User jail already exists. Blow it away but preserve their home
274
270
        # directory. It should be all that is there anyway, but you never
275
271
        # know!
276
 
        # Ignore warnings about the use of tempnam
 
272
        # Ignore warnings about the use of tmpnam
277
273
        warnings.simplefilter('ignore')
278
274
        homebackup = os.tempnam(tempdir)
279
275
        warnings.resetwarnings()
328
324
    # So we just write root_dir.
329
325
    conf_obj = ivle.config.Config(blank=True)
330
326
    conf_obj.filename = conf_path
331
 
    conf_obj['urls'] = {}
332
327
    conf_obj['urls']['root'] = sys_config['urls']['root']
333
328
    conf_obj['urls']['public_host'] = sys_config['urls']['public_host']
334
329
    conf_obj['urls']['svn_addr'] = sys_config['urls']['svn_addr']
335
 
    conf_obj['user_info'] = {}
336
330
    conf_obj['user_info']['login'] = username
337
331
    conf_obj['user_info']['svn_pass'] = svn_pass
338
332
    conf_obj.write()