figure out correctly the content-type for request.restful. Thanks @mcabo

This commit is contained in:
niphlod
2013-08-20 21:23:18 +02:00
parent 6448518ce0
commit ab58af3c87
+2 -3
View File
@@ -310,10 +310,9 @@ class Request(Storage):
self.is_restful = True self.is_restful = True
method = _self.env.request_method method = _self.env.request_method
if len(_self.args) and '.' in _self.args[-1]: if len(_self.args) and '.' in _self.args[-1]:
_self.args[- _self.args[-1], _, self.extension = self.args[-1].rpartition('.')
1], _self.extension = _self.args[-1].rsplit('.', 1)
current.response.headers['Content-Type'] = \ current.response.headers['Content-Type'] = \
contenttype(_self.extension.lower()) contenttype('.' + _self.extension.lower())
if not method in ['GET', 'POST', 'DELETE', 'PUT']: if not method in ['GET', 'POST', 'DELETE', 'PUT']:
raise HTTP(400, "invalid method") raise HTTP(400, "invalid method")
rest_action = _action().get(method, None) rest_action = _action().get(method, None)