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

« back to all changes in this revision

Viewing changes to ivle/dispatch/request.py

  • Committer: William Grant
  • Date: 2009-02-25 23:04:11 UTC
  • Revision ID: grantw@unimelb.edu.au-20090225230411-lbdyl32ir0m3d59b
Make all of the services executable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    pass
35
35
 
36
36
import ivle.util
 
37
import ivle.conf
37
38
import ivle.database
38
39
from ivle.webapp.base.plugins import CookiePlugin
39
40
 
153
154
    HTTP_INSUFFICIENT_STORAGE         = 507
154
155
    HTTP_NOT_EXTENDED                 = 510
155
156
 
156
 
    def __init__(self, req, config):
157
 
        """Create an IVLE request from a mod_python one.
 
157
    def __init__(self, req):
 
158
        """Builds an IVLE request object from a mod_python request object.
 
159
        This results in an object with all of the necessary methods and
 
160
        additional fields.
158
161
 
159
 
        @param req: A mod_python request.
160
 
        @param config: An IVLE configuration.
 
162
        req: A mod_python request object.
161
163
        """
162
164
 
163
165
        # Methods are mostly wrappers around the Apache request object
164
166
        self.apache_req = req
165
 
        self.config = config
166
167
        self.headers_written = False
167
168
 
168
169
        # Determine if the browser used the public host name to make the
169
170
        # request (in which case we are in "public mode")
170
 
        if req.hostname == config['urls']['public_host']:
 
171
        if req.hostname == ivle.conf.public_host:
171
172
            self.publicmode = True
172
173
        else:
173
174
            self.publicmode = False
186
187
 
187
188
        # Open a database connection and transaction, keep it around for users
188
189
        # of the Request object to use
189
 
        self.store = ivle.database.get_store(config)
 
190
        self.store = ivle.database.get_store()
190
191
 
191
192
        # Default values for the output members
192
193
        self.status = Request.HTTP_OK
294
295
    def get_session(self):
295
296
        """Returns a mod_python Session object for this request.
296
297
        Note that this is dependent on mod_python and may need to change
297
 
        interface if porting away from mod_python.
298
 
 
299
 
        IMPORTANT: Call unlock() on the session as soon as you are done with
300
 
                   it! If you don't, all other requests will block!
301
 
        """
 
298
        interface if porting away from mod_python."""
302
299
        # Cache the session object and set the timeout to 24 hours.
303
300
        if not hasattr(self, 'session'):
304
301
            self.session = mod_python.Session.FileSession(self.apache_req,