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

« back to all changes in this revision

Viewing changes to www/apps/download/__init__.py

  • Committer: mattgiuca
  • Date: 2008-02-28 08:00:59 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:609
browser: Now stats the file requested before doing anything else.
    Error if invalid.
    Determines correctly whether it is a dir or a file.
server, download: Proper error messages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        (_, path) = studpath.url_to_local(req.path)
66
66
        if path is None:
67
67
            # TODO: Nicer 404 message?
68
 
            req.throw_error(req.HTTP_NOT_FOUND)
 
68
            req.throw_error(req.HTTP_NOT_FOUND,
 
69
                "The path specified is invalid.")
69
70
        elif not os.access(path, os.R_OK):
70
 
            req.throw_error(req.HTTP_NOT_FOUND)
 
71
            req.throw_error(req.HTTP_NOT_FOUND,
 
72
                "The specified file does not exist.")
71
73
        # If it's a directory, serve as a zip file
72
74
        if os.path.isdir(path):
73
75
            zipmode = True