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

« back to all changes in this revision

Viewing changes to www/dispatch/request.py

  • Committer: mattgiuca
  • Date: 2008-02-29 01:18:22 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:621
Added 2 new apps: home and subjects. Both fairly incomplete, just a basic
    skeleton.
    "home" is the new default app, replacing "files".
    (It has a link to files).

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
31
30
 
32
31
class Request:
33
32
    """An IVLE request object. This is presented to the IVLE apps as a way of
81
80
            in the head, if write_html_head_foot is True.
82
81
            URLs should be relative to the IVLE root; they will be fixed up
83
82
            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.
90
83
        write_html_head_foot (write)
91
84
            Boolean. If True, dispatch assumes that this is an XHTML page, and
92
85
            will immediately write a full HTML head, open the body element,
185
178
        # Split the given path into the app (top-level dir) and sub-path
186
179
        # (after first stripping away the root directory)
187
180
        path = common.util.unmake_path(req.uri)
188
 
        (self.app, self.path) = (common.util.split_path(path))
 
181
        if self.publicmode:
 
182
            self.app = None
 
183
            self.path = path
 
184
        else:
 
185
            (self.app, self.path) = (common.util.split_path(path))
189
186
        self.user = None
190
187
        self.hostname = req.hostname
191
188
        self.headers_in = req.headers_in
198
195
        self.title = None     # Will be set by dispatch before passing to app
199
196
        self.styles = []
200
197
        self.scripts = []
201
 
        self.scripts_init = []
202
198
        self.write_html_head_foot = False
203
199
        self.got_common_vars = False
204
200
 
206
202
        """Writes out the HTTP and HTML headers before any real data is
207
203
        written."""
208
204
        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
 
 
221
205
        # Prepare the HTTP and HTML headers before the first write is made
222
206
        if self.content_type != None:
223
207
            self.apache_req.content_type = self.content_type