89
89
# HTTP status codes
92
HTTP_SWITCHING_PROTOCOLS = 101
97
HTTP_NON_AUTHORITATIVE = 203
99
HTTP_RESET_CONTENT = 205
100
HTTP_PARTIAL_CONTENT = 206
101
HTTP_MULTI_STATUS = 207
102
HTTP_MULTIPLE_CHOICES = 300
103
HTTP_MOVED_PERMANENTLY = 301
104
92
HTTP_MOVED_TEMPORARILY = 302
106
HTTP_NOT_MODIFIED = 304
108
HTTP_TEMPORARY_REDIRECT = 307
109
HTTP_BAD_REQUEST = 400
110
HTTP_UNAUTHORIZED = 401
111
HTTP_PAYMENT_REQUIRED = 402
112
93
HTTP_FORBIDDEN = 403
113
94
HTTP_NOT_FOUND = 404
114
HTTP_METHOD_NOT_ALLOWED = 405
115
HTTP_NOT_ACCEPTABLE = 406
116
HTTP_PROXY_AUTHENTICATION_REQUIRED= 407
117
HTTP_REQUEST_TIME_OUT = 408
120
HTTP_LENGTH_REQUIRED = 411
121
HTTP_PRECONDITION_FAILED = 412
122
HTTP_REQUEST_ENTITY_TOO_LARGE = 413
123
HTTP_REQUEST_URI_TOO_LARGE = 414
124
HTTP_UNSUPPORTED_MEDIA_TYPE = 415
125
HTTP_RANGE_NOT_SATISFIABLE = 416
126
HTTP_EXPECTATION_FAILED = 417
127
HTTP_UNPROCESSABLE_ENTITY = 422
129
HTTP_FAILED_DEPENDENCY = 424
130
95
HTTP_INTERNAL_SERVER_ERROR = 500
131
HTTP_NOT_IMPLEMENTED = 501
132
HTTP_BAD_GATEWAY = 502
133
HTTP_SERVICE_UNAVAILABLE = 503
134
HTTP_GATEWAY_TIME_OUT = 504
135
HTTP_VERSION_NOT_SUPPORTED = 505
136
HTTP_VARIANT_ALSO_VARIES = 506
137
HTTP_INSUFFICIENT_STORAGE = 507
138
HTTP_NOT_EXTENDED = 510
140
97
def __init__(self, req, config):
141
98
"""Create an IVLE request from a mod_python one.
347
304
# Human strings for HTTP response codes
348
305
http_codenames = {
349
Request.HTTP_BAD_REQUEST:
351
"Your browser sent a request IVLE did not understand."),
352
Request.HTTP_UNAUTHORIZED:
354
"You are not allowed to view this part of IVLE."),
355
306
Request.HTTP_FORBIDDEN:
357
308
"You are not allowed to view this part of IVLE."),
358
309
Request.HTTP_NOT_FOUND:
360
311
"The application or file you requested does not exist."),
361
Request.HTTP_METHOD_NOT_ALLOWED:
362
("Method Not Allowed",
363
"Your browser is interacting with IVLE in the wrong way."
364
"This is probably a bug in IVLE. "
365
"Please report it to the administrators."),
366
312
Request.HTTP_INTERNAL_SERVER_ERROR:
367
313
("Internal Server Error",
368
314
"An unknown error occured in IVLE."),
369
Request.HTTP_NOT_IMPLEMENTED:
371
"The application or file you requested has not been implemented "
373
Request.HTTP_SERVICE_UNAVAILABLE:
374
("Service Unavailable",
375
"IVLE is currently experiencing technical difficulties. "
376
"Please try again later."),