equal
deleted
inserted
replaced
21 """Binding of CubicWeb connection to Pyramid request.""" |
21 """Binding of CubicWeb connection to Pyramid request.""" |
22 |
22 |
23 import itertools |
23 import itertools |
24 |
24 |
25 from contextlib import contextmanager |
25 from contextlib import contextmanager |
26 from warnings import warn |
|
27 from cgi import FieldStorage |
26 from cgi import FieldStorage |
28 |
27 |
29 import rql |
28 import rql |
30 |
29 |
31 from cubicweb.web.request import CubicWebRequestBase |
30 from cubicweb.web.request import CubicWebRequestBase |
122 yield |
121 yield |
123 except cubicweb.web.Redirect as ex: |
122 except cubicweb.web.Redirect as ex: |
124 assert 300 <= ex.status < 400 |
123 assert 300 <= ex.status < 400 |
125 raise httpexceptions.status_map[ex.status]( |
124 raise httpexceptions.status_map[ex.status]( |
126 ex.location, headers=cw_headers(request)) |
125 ex.location, headers=cw_headers(request)) |
127 except cubicweb.web.StatusResponse as ex: |
|
128 warn('[3.16] StatusResponse is deprecated use req.status_out', |
|
129 DeprecationWarning, stacklevel=2) |
|
130 request.body = ex.content |
|
131 request.status_int = ex.status |
|
132 except cubicweb.web.Unauthorized: |
126 except cubicweb.web.Unauthorized: |
133 raise httpexceptions.HTTPForbidden( |
127 raise httpexceptions.HTTPForbidden( |
134 request.cw_request._( |
128 request.cw_request._( |
135 'You\'re not authorized to access this page. ' |
129 'You\'re not authorized to access this page. ' |
136 'If you think you should, please contact the site ' |
130 'If you think you should, please contact the site ' |