|
a/Allura/allura/lib/base.py |
|
b/Allura/allura/lib/base.py |
|
... |
|
... |
17 |
# specific language governing permissions and limitations
|
17 |
# specific language governing permissions and limitations
|
18 |
# under the License.
|
18 |
# under the License.
|
19 |
|
19 |
|
20 |
"""The base Controller API."""
|
20 |
"""The base Controller API."""
|
21 |
from webob import exc
|
21 |
from webob import exc
|
|
|
22 |
import pylons
|
22 |
from tg import TGController, config
|
23 |
from tg import TGController, config
|
23 |
|
24 |
|
24 |
__all__ = ['WsgiDispatchController']
|
25 |
__all__ = ['WsgiDispatchController']
|
25 |
|
26 |
|
26 |
class WsgiDispatchController(TGController):
|
27 |
class WsgiDispatchController(TGController):
|
|
... |
|
... |
49 |
|
50 |
|
50 |
def cleanup_iterator(self, response):
|
51 |
def cleanup_iterator(self, response):
|
51 |
for chunk in response: yield chunk
|
52 |
for chunk in response: yield chunk
|
52 |
self._cleanup_request()
|
53 |
self._cleanup_request()
|
53 |
|
54 |
|
|
|
55 |
def _get_dispatchable(self, url_path):
|
|
|
56 |
"""Patch ``TGController._get_dispatchable`` by overriding.
|
54 |
|
57 |
|
|
|
58 |
This fixes a bug in TG 2.1.5 that causes ``request.response_type``
|
|
|
59 |
to not be created if ``disable_request_extensions = True`` (see
|
|
|
60 |
allura/config/app_cfg.py).
|
|
|
61 |
|
|
|
62 |
``request.response_type`` must be set because the "trailing slash"
|
|
|
63 |
decorators use it (see allura/lib/patches.py).
|
|
|
64 |
|
|
|
65 |
This entire method can be removed if/when we upgrade to TG >= 2.2.1
|
|
|
66 |
|
|
|
67 |
"""
|
|
|
68 |
pylons.request.response_type = None
|
|
|
69 |
return super(WsgiDispatchController, self)._get_dispatchable(url_path)
|