~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 06:20:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:532
db.py: Augmented create_user.
    Now able to accept a User object instead of a set of fields.
    This will create a user in the DB from the fields of the User object
    instead.

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