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

« back to all changes in this revision

Viewing changes to lib/common/cgirequest.py

  • Committer: mattgiuca
  • Date: 2008-02-21 07:08:07 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:533
auth/authenticate: Much done!
    Fixed immediate failure if user not in DB (now sets user to None to give
    it the chance to pulldown).
    Now writes the user to the DB if a user object is returned.
    Fixed simple_db_auth raising if the user is not in the DB. It now returns
    None, again, to give chance to pulldown.
    Fixed importing modules - the auth dir is not in sys.path so there are
    import errors. Did some foo (a LOT of magic) to get the auth dir in
    sys.path.

auth/ldap_auth: Fixed missing import.
auth/guest_auth: Added new auth module, guest. This is more of a toy.
    It auths guest/guest and also returns a new user which is written to the
    DB - so it's like a user pulldown module.

userdb/users.sql: Fixed rolenms allowed - these did not match caps.Role.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
import cgi
34
34
 
35
35
import conf
 
36
import common
 
37
import common.util
36
38
 
37
39
# Utility functions
38
40
 
119
121
        """
120
122
        self.headers_written = False
121
123
 
 
124
        if ('SERVER_NAME' not in os.environ or
 
125
            'REQUEST_METHOD' not in os.environ or
 
126
            'REQUEST_URI' not in os.environ):
 
127
            raise Exception("No CGI environment found")
 
128
 
122
129
        # Determine if the browser used the public host name to make the
123
130
        # request (in which case we are in "public mode")
124
131
        if os.environ['SERVER_NAME'] == conf.public_host:
137
144
            self.path = path
138
145
        else:
139
146
            (self.app, self.path) = (common.util.split_path(path))
140
 
        self.username = None
 
147
        self.user = None
141
148
        self.hostname = os.environ['SERVER_NAME']
142
149
        self.headers_in = _http_headers_in_from_cgi()
143
150
        self.headers_out = {}
222
229
        f = open(filename)
223
230
        buf = f.read(1024)
224
231
        while len(buf) > 0:
225
 
            sys.stdout.flush(buf)
 
232
            sys.stdout.write(buf)
 
233
            sys.stdout.flush()
226
234
            buf = f.read(1024)
227
235
        f.close()
228
236