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

« back to all changes in this revision

Viewing changes to ivle/dispatch/__init__.py

  • Committer: Matt Giuca
  • Date: 2010-02-24 13:13:21 UTC
  • mfrom: (1689.1.19 worksheet-marks)
  • Revision ID: matt.giuca@gmail.com-20100224131321-eno7xbrqsyukz869
Added worksheet marks reporting UI for lecturers. This includes the ability to view worksheet marks table in the web application and download as a CSV, as well as some basic statistics on exercise completion. Removed the ivle-marks script, as now lecturers can get the same data themselves. Fixes Launchpad bug #520179.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
    # Make the request object into an IVLE request which can be given to views
127
127
    req = Request(apachereq, config)
128
128
 
 
129
    # Hack? Try and get the user login early just in case we throw an error
 
130
    # (most likely 404) to stop us seeing not logged in even when we are.
 
131
    if not req.publicmode:
 
132
        user = ivle.webapp.security.get_user_details(req)
 
133
 
 
134
        # Don't set the user if it is disabled or hasn't accepted the ToS.
 
135
        if user and user.valid:
 
136
            req.user = user
 
137
 
129
138
    req.publisher = generate_publisher(
130
 
        config.plugin_index[ViewPlugin], ApplicationRoot(req),
 
139
        config.plugin_index[ViewPlugin],
 
140
        ApplicationRoot(req.config, req.store, req.user),
131
141
        publicmode=req.publicmode)
132
142
 
133
143
    try:
191
201
            handle_unknown_exception(req, *sys.exc_info())
192
202
            return req.OK
193
203
        else:
194
 
            # Commit the transaction if we have a store open.
195
 
            req.commit()
 
204
            req.store.commit()
196
205
            return req.OK
197
206
    except Unauthorized, e:
198
207
        # Resolution failed due to a permission check. Display a pretty
210
219
 
211
220
        return req.OK
212
221
    finally:
213
 
        # Make sure we close the store.
214
 
        req.cleanup()
 
222
        req.store.close()
215
223
 
216
224
def handle_unknown_exception(req, exc_type, exc_value, exc_traceback):
217
225
    """