Changeset 4865
- Timestamp:
- 03/30/07 01:46:36 (2 years ago)
- Files:
-
- django/trunk/django/http/__init__.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/http/__init__.py
r4615 r4865 156 156 class HttpResponse(object): 157 157 "A basic HTTP response, with content and dictionary-accessed headers" 158 159 status_code = 200 160 158 161 def __init__(self, content='', mimetype=None): 159 162 from django.conf import settings … … 169 172 self.headers = {'Content-Type': mimetype} 170 173 self.cookies = SimpleCookie() 171 self.status_code = 200172 174 173 175 def __str__(self): … … 255 257 256 258 class HttpResponseRedirect(HttpResponse): 259 status_code = 302 260 257 261 def __init__(self, redirect_to): 258 262 HttpResponse.__init__(self) 259 263 self['Location'] = quote(redirect_to, safe=RESERVED_CHARS) 260 self.status_code = 302261 264 262 265 class HttpResponsePermanentRedirect(HttpResponse): 266 status_code = 301 267 263 268 def __init__(self, redirect_to): 264 269 HttpResponse.__init__(self) 265 270 self['Location'] = quote(redirect_to, safe=RESERVED_CHARS) 266 self.status_code = 301267 271 268 272 class HttpResponseNotModified(HttpResponse): 269 def __init__(self): 270 HttpResponse.__init__(self) 271 self.status_code = 304 273 status_code = 304 272 274 273 275 class HttpResponseNotFound(HttpResponse): 274 def __init__(self, *args, **kwargs): 275 HttpResponse.__init__(self, *args, **kwargs) 276 self.status_code = 404 276 status_code = 404 277 277 278 278 class HttpResponseForbidden(HttpResponse): 279 def __init__(self, *args, **kwargs): 280 HttpResponse.__init__(self, *args, **kwargs) 281 self.status_code = 403 279 status_code = 403 282 280 283 281 class HttpResponseNotAllowed(HttpResponse): 282 status_code = 405 283 284 284 def __init__(self, permitted_methods): 285 285 HttpResponse.__init__(self) 286 286 self['Allow'] = ', '.join(permitted_methods) 287 self.status_code = 405288 287 289 288 class HttpResponseGone(HttpResponse): 289 status_code = 410 290 290 291 def __init__(self, *args, **kwargs): 291 292 HttpResponse.__init__(self, *args, **kwargs) 292 self.status_code = 410293 293 294 294 class HttpResponseServerError(HttpResponse): 295 status_code = 500 296 295 297 def __init__(self, *args, **kwargs): 296 298 HttpResponse.__init__(self, *args, **kwargs) 297 self.status_code = 500298 299 299 300 def get_host(request):
