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

« back to all changes in this revision

Viewing changes to ivle/webapp/submit/__init__.py

  • Committer: Matt Giuca
  • Date: 2010-07-22 02:12:36 UTC
  • mfrom: (1812.1.13 late-submit)
  • Revision ID: matt.giuca@gmail.com-20100722021236-k8kt4cqdtywzpk24
Merge from trunk late-submit.
Students may now submit projects after the deadline, but they are warned that the submission is late.
Lecturers are now given data on which submissions were made late, and how many days.
(LP: #598346)

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
            except ValueError:
86
86
                raise BadRequest('Project must be an integer.')
87
87
 
 
88
            # True, if the user has confirmed to submit late
 
89
            late = 'late' in data and data['late'] == "yes"
 
90
 
88
91
            project = req.store.find(Project, Project.id == projectid).one()
89
92
 
90
93
            # This view's offering will be the sole offering for which the
97
100
 
98
101
            try:
99
102
                ctx['submission'] = project.submit(self.context,
100
 
                                    unicode(self.path), revision, req.user)
101
 
            except (database.DeadlinePassed, database.SubmissionError), e:
 
103
                                    unicode(self.path), revision, req.user,
 
104
                                    late=late)
 
105
            except database.DeadlinePassed:
 
106
                # Show late submission page
 
107
                self.template = 'submit-late.html'
 
108
                ctx['project'] = project
 
109
            except database.SubmissionError, e:
102
110
                raise BadRequest(str(e) + ".")
103
 
 
104
 
            # The Subversion configuration needs to be updated, to grant
105
 
            # tutors and lecturers access to this submission. We have to 
106
 
            # commit early so usrmgt-server can see the new submission.
107
 
            req.store.commit()
108
 
 
109
 
            # Instruct usrmgt-server to rebuild the SVN group authz file.
110
 
            msg = {'rebuild_svn_group_config': {}}
111
 
            usrmgt = ivle.chat.chat(req.config['usrmgt']['host'],
112
 
                                    req.config['usrmgt']['port'],
113
 
                                    msg,
114
 
                                    req.config['usrmgt']['magic'],
115
 
                                    )
116
 
 
117
 
            if usrmgt.get('response') in (None, 'failure'):
118
 
                raise Exception("Failure creating repository: " + str(usrmgt))
119
 
 
120
 
            # Instruct usrmgt-server to rebuild the SVN user authz file.
121
 
            msg = {'rebuild_svn_config': {}}
122
 
            usrmgt = ivle.chat.chat(req.config['usrmgt']['host'],
123
 
                                    req.config['usrmgt']['port'],
124
 
                                    msg,
125
 
                                    req.config['usrmgt']['magic'],
126
 
                                    )
127
 
 
128
 
            if usrmgt.get('response') in (None, 'failure'):
129
 
                raise Exception("Failure creating repository: " + str(usrmgt))
130
 
 
131
 
            self.template = 'submitted.html'
132
 
            ctx['project'] = project
 
111
            else:
 
112
                # The Subversion configuration needs to be updated, to grant
 
113
                # tutors and lecturers access to this submission. We have to 
 
114
                # commit early so usrmgt-server can see the new submission.
 
115
                req.store.commit()
 
116
 
 
117
                # Instruct usrmgt-server to rebuild the SVN group authz file.
 
118
                msg = {'rebuild_svn_group_config': {}}
 
119
                usrmgt = ivle.chat.chat(req.config['usrmgt']['host'],
 
120
                                        req.config['usrmgt']['port'],
 
121
                                        msg,
 
122
                                        req.config['usrmgt']['magic'],
 
123
                                        )
 
124
 
 
125
                if usrmgt.get('response') in (None, 'failure'):
 
126
                    raise Exception("Failure creating repository: "
 
127
                                    + str(usrmgt))
 
128
 
 
129
                # Instruct usrmgt-server to rebuild the SVN user authz file.
 
130
                msg = {'rebuild_svn_config': {}}
 
131
                usrmgt = ivle.chat.chat(req.config['usrmgt']['host'],
 
132
                                        req.config['usrmgt']['port'],
 
133
                                        msg,
 
134
                                        req.config['usrmgt']['magic'],
 
135
                                        )
 
136
 
 
137
                if usrmgt.get('response') in (None, 'failure'):
 
138
                    raise Exception("Failure creating repository: "
 
139
                                    + str(usrmgt))
 
140
 
 
141
                self.template = 'submitted.html'
 
142
                ctx['project'] = project
133
143
 
134
144
        ctx['req'] = req
135
145
        ctx['principal'] = self.context