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

« back to all changes in this revision

Viewing changes to www/dispatch/request.py

  • Committer: wagrant
  • Date: 2008-07-23 02:42:54 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:935
userdb: Large changes:
 - Split out semesters into their own table.
 - Give semesters and enrolments an active flag.
   + Enrolments cannot be active if their semester is not.
 - Introduce the project set concept, to link groups to projects.
   + Groups and projects now reference a project set, not an offering.

Also update the DB access code to respect the group changes.

<FONT COLOR="red"><BLINK>

  ** WARNING: This migration will destroy all groups, enrolments and
              offerings. **

</BLINK></FONT>

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import mod_python
28
28
from mod_python import (util, Session, Cookie)
29
29
import conf
 
30
import plugins.console
30
31
 
31
32
class Request:
32
33
    """An IVLE request object. This is presented to the IVLE apps as a way of
80
81
            in the head, if write_html_head_foot is True.
81
82
            URLs should be relative to the IVLE root; they will be fixed up
82
83
            to be site-relative.
 
84
        scripts_init (write)
 
85
            List of strings. Write a list of JS function names, and they
 
86
            will be added as window.addListener('load', ..., false); calls
 
87
            in the head, if write_html_head_foot is True.
 
88
            This is the propper way to specify functions that need to run at 
 
89
            page load time.
83
90
        write_html_head_foot (write)
84
91
            Boolean. If True, dispatch assumes that this is an XHTML page, and
85
92
            will immediately write a full HTML head, open the body element,
178
185
        # Split the given path into the app (top-level dir) and sub-path
179
186
        # (after first stripping away the root directory)
180
187
        path = common.util.unmake_path(req.uri)
181
 
        if self.publicmode:
182
 
            self.app = None
183
 
            self.path = path
184
 
        else:
185
 
            (self.app, self.path) = (common.util.split_path(path))
 
188
        (self.app, self.path) = (common.util.split_path(path))
186
189
        self.user = None
187
190
        self.hostname = req.hostname
188
191
        self.headers_in = req.headers_in
195
198
        self.title = None     # Will be set by dispatch before passing to app
196
199
        self.styles = []
197
200
        self.scripts = []
 
201
        self.scripts_init = []
198
202
        self.write_html_head_foot = False
199
203
        self.got_common_vars = False
200
204
 
202
206
        """Writes out the HTTP and HTML headers before any real data is
203
207
        written."""
204
208
        self.headers_written = True
 
209
        
 
210
        # app is the App object for the chosen app
 
211
        try:
 
212
            app = conf.apps.app_url[self.app]
 
213
        except KeyError:
 
214
            app = None
 
215
 
 
216
        # Write any final modifications to header content
 
217
        if app and app.useconsole and self.user:
 
218
            plugins.console.insert_scripts_styles(self.scripts, self.styles, \
 
219
                self.scripts_init)
 
220
 
205
221
        # Prepare the HTTP and HTML headers before the first write is made
206
222
        if self.content_type != None:
207
223
            self.apache_req.content_type = self.content_type