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

« back to all changes in this revision

Viewing changes to ivle/cgirequest.py

  • Committer: Matt Giuca
  • Date: 2010-07-21 04:12:30 UTC
  • Revision ID: matt.giuca@gmail.com-20100721041230-hlrn2q3fx2uvaprd
ivle.webapp.admin.user: Fixed call to req.user.get_svn_url (now takes 1 argument, as of r1810).
Fixes Internal server error on Settings page (since r1810).

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        self.uri = os.environ['SCRIPT_NAME'] + os.environ['PATH_INFO']
139
139
        # Split the given path into the app (top-level dir) and sub-path
140
140
        # (after first stripping away the root directory)
141
 
        path = self.unmake_path(self.uri)
142
141
        if self.publicmode:
143
142
            self.app = None
144
 
            (_, self.path) = (ivle.util.split_path(path))
 
143
            (_, self.path) = (ivle.util.split_path(self.uri))
145
144
        else:
146
 
            (self.app, self.path) = (ivle.util.split_path(path))
 
145
            (self.app, self.path) = (ivle.util.split_path(self.uri))
147
146
        self.user = None
148
147
        self.hostname = os.environ['SERVER_NAME']
149
148
        self.headers_in = _http_headers_in_from_cgi()
242
241
            return sys.stdin.read(len)
243
242
 
244
243
    def handle_unknown_exception(self, exc_type, exc_value, exc_tb):
245
 
        if exc_type is ivle.util.IVLEError:
246
 
            self.headers_out['X-IVLE-Error-Code'] = exc_value.httpcode
247
 
 
248
244
        self.headers_out['X-IVLE-Error-Type'] = exc_type.__name__
249
245
 
250
246
        try:
273
269
        self.flush()
274
270
        sys.exit(self.status)
275
271
 
276
 
    def unmake_path(self, path):
277
 
        """Strip the IVLE URL prefix from the given path, if present.
278
 
 
279
 
        Also normalises the path.
280
 
        """
281
 
        path = os.path.normpath(path)
282
 
        root = os.path.normpath(ivle.conf.root_dir)
283
 
 
284
 
        if path.startswith(root):
285
 
            path = path[len(root):]
286
 
            # Take out the slash as well
287
 
            if len(path) > 0 and path[0] == os.sep:
288
 
                path = path[1:]
289
 
 
290
 
        return path
291
 
 
292
272
    def get_session(self):
293
273
        """Returns a mod_python Session object for this request.
294
274
        Note that this is dependent on mod_python and may need to change