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

« back to all changes in this revision

Viewing changes to ivle/cgirequest.py

  • Committer: William Grant
  • Date: 2009-12-08 03:50:24 UTC
  • mfrom: (1294.2.143 ui-the-third)
  • Revision ID: grantw@unimelb.edu.au-20091208035024-wjx8zp54gth15ph8
Merge ui-the-third. This is another UI revamp.

The header is now thin! Thin! The yellow bar is gone. The tabs are gone.
Breadcrumbs are here. Routes is replaced (with an object publishing
mechanism). Views are less repetitive. etc.

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()
273
272
        self.flush()
274
273
        sys.exit(self.status)
275
274
 
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
275
    def get_session(self):
293
276
        """Returns a mod_python Session object for this request.
294
277
        Note that this is dependent on mod_python and may need to change