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

« back to all changes in this revision

Viewing changes to ivle/fileservice_lib/listing.py

  • Committer: chadnickbok
  • Date: 2009-01-22 02:14:14 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1173
Fixes Issue #14

When uploading files, students will now be shown an
error message if there upload would replace already existing
files.

This upload will not be performed until it will not clobber
any old files.

Note that there is currently a way to change this behaviour in
the code in action.py, to allow files to be overwritten. However
there is no way this flag can be set through the browser interface
(yet).

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
    # Currently goes to 403 Forbidden.
147
147
    urlpath = urlparse.urlparse(path)
148
148
    path = urlpath[2]
 
149
    json = None
149
150
    if path is None:
150
151
        req.status = req.HTTP_FORBIDDEN
151
152
        req.headers_out['X-IVLE-Return-Error'] = 'Forbidden'
158
159
        # It's a directory. Return the directory listing.
159
160
        req.content_type = mime_dirlisting
160
161
        req.headers_out['X-IVLE-Return'] = 'Dir'
161
 
        req.write(cjson.encode(get_dirlisting(req, svnclient, path)))
 
162
        # TODO: Fix this dirty, dirty hack
 
163
        newjson = get_dirlisting(req, svnclient, path)
 
164
        if ("X-IVLE-Action-Error" in req.headers_out):
 
165
            newjson["Error"] = req.headers_out["X-IVLE-Action-Error"]
 
166
        req.write(cjson.encode(newjson))
162
167
    elif return_contents:
163
168
        # It's a file. Return the file contents.
164
169
        # First get the mime type of this file