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

« back to all changes in this revision

Viewing changes to ivle/dispatch/request.py

  • Committer: chadnickbok
  • Date: 2009-01-19 22:56:46 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1170
This commit fixes issue #10 and part of issue #9

There are now two options for moving files with their
svn history intact; svn move and svn copy. These
use the svn commands to move the files, allowing students
to move and rename files without their histories being
lost.

This commit also shows the svn status of a dir, if it is
the 'head' of an svn repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# IVLE - Informatics Virtual Learning Environment
2
 
# Copyright (C) 2007-2009 The University of Melbourne
 
2
# Copyright (C) 2007-2008 The University of Melbourne
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
5
5
# it under the terms of the GNU General Public License as published by
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
 
18
# Module: dispatch.request
18
19
# Author: Matt Giuca
19
 
 
20
 
"""
21
 
IVLE Request Object
22
 
 
23
 
Builds an IVLE request object from a mod_python request object.
24
 
See design notes/apps/dispatch.txt for a full specification of this request
25
 
object.
26
 
"""
 
20
# Date:   12/12/2007
 
21
 
 
22
# Builds an IVLE request object from a mod_python request object.
 
23
# See design notes/apps/dispatch.txt for a full specification of this request
 
24
# object.
27
25
 
28
26
import mod_python
29
27
from mod_python import (util, Session, Cookie)
30
28
 
31
29
import ivle.util
32
30
import ivle.conf
33
 
import ivle.database
34
31
import plugins.console # XXX: Relies on www/ being in the Python path.
35
32
 
36
33
class Request:
51
48
        user (read)
52
49
            User object. Details of the user who is currently logged in, or
53
50
            None.
54
 
        store (read)
55
 
            storm.store.Store instance. Holds a database transaction open,
56
 
            which is available for the entire lifetime of the request.
57
51
        hostname (read)
58
52
            String. Hostname the server is running on.
59
53
        headers_in (read)
198
192
        self.headers_in = req.headers_in
199
193
        self.headers_out = req.headers_out
200
194
 
201
 
        # Open a database connection and transaction, keep it around for users
202
 
        # of the Request object to use
203
 
        self.store = ivle.database.get_store()
204
 
 
205
195
        # Default values for the output members
206
196
        self.status = Request.HTTP_OK
207
197
        self.content_type = None        # Use Apache's default
216
206
        self.write_javascript_settings = True
217
207
        self.got_common_vars = False
218
208
 
219
 
    def __del__(self):
220
 
        """Cleanup."""
221
 
        self.store.close()
222
 
 
223
209
    def __writeheaders(self):
224
210
        """Writes out the HTTP and HTML headers before any real data is
225
211
        written."""
320
306
        httpcode: An HTTP response status code. Pass a constant from the
321
307
        Request class.
322
308
        """
323
 
        # Note: location may be a unicode, but it MUST only have ASCII
324
 
        # characters (non-ascii characters should be URL-encoded).
325
 
        mod_python.util.redirect(self.apache_req, location.encode("ascii"))
 
309
        mod_python.util.redirect(self.apache_req, location)
326
310
 
327
311
    def add_cookie(self, cookie, value=None, **attributes):
328
312
        """Inserts a cookie into this request object's headers."""