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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-02-28 08:03:25 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:610
server, download: More fixes to error messages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
            interp_object = interpret.interpreter_objects[interp_name]
94
94
            (_, jail_dir, path) = studpath.url_to_jailpaths(req.path)
95
95
        except KeyError:
96
 
            # TODO: Nicer 500 message (this is due to bad configuration in
97
 
            # conf/app/server.py)
98
96
            req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
99
97
                "The interpreter for this file has not been "
100
98
                "configured correctly.")
110
108
 
111
109
        # toserve or not toserve
112
110
        if not toserve:
113
 
            # TODO: Nicer 403 message
114
 
            req.throw_error(req.HTTP_FORBIDDEN)
 
111
            req.throw_error(req.HTTP_FORBIDDEN,
 
112
                "Files of this type are not allowed to be served.")
115
113
        else:
116
114
            serve_file_direct(req, filename, type)
117
115
 
123
121
    type: String. Mime type to serve the file with.
124
122
    """
125
123
    if not os.access(filename, os.R_OK):
126
 
        req.throw_error(req.HTTP_NOT_FOUND)
 
124
        req.throw_error(req.HTTP_NOT_FOUND,
 
125
            "The specified file does not exist.")
127
126
    req.content_type = type
128
127
    req.sendfile(filename)