Ticket #5176: 0001_fix_test_client.diff
File 0001_fix_test_client.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/test/client.py
177 177 return {} 178 178 session = property(_session) 179 179 180 def _format_cookies(self): 181 """ 182 Generates a string suitable for a HTTP request from a SimpleCookie 183 cookie jar. 184 185 Ideally this should be done with a propper cookie jar, where only 186 the cookies valid for the request path and time are send in the 187 request. Unfortunatly cookielib.CookieJar isn't the right candidate. 188 """ 189 cookie_strings = self.cookies.output().split('Set-Cookie: ') 190 while '' in cookie_strings: 191 cookie_strings.remove('') 192 193 cookies = [] 194 for cookie in cookie_strings: 195 cookies.append(cookie.split(';', 1)[0]) 196 197 return '; '.join(cookies) 198 180 199 def request(self, **request): 181 200 """ 182 201 The master request method. Composes the environment dictionary … … 185 204 using the arguments to the request. 186 205 """ 187 206 environ = { 188 'HTTP_COOKIE': self.cookies,207 'HTTP_COOKIE': self._format_cookies(), 189 208 'PATH_INFO': '/', 190 209 'QUERY_STRING': '', 191 210 'REQUEST_METHOD': 'GET', -
AUTHORS
237 237 Lau Bech Lauritzen 238 238 Rune Rønde Laursen <runerl@skjoldhoej.dk> 239 239 Eugene Lazutkin <http://lazutkin.com/blog/> 240 lcordier@point45.com240 Louis Cordier <lcordier@gmail.com> 241 241 Jeong-Min Lee <falsetru@gmail.com> 242 242 Jannis Leidel <jl@websushi.org> 243 243 Christopher Lenz <http://www.cmlenz.net/>