On 4/6/10 3:15 AM, Chris Withers wrote:
> Chris McDonough wrote:
>>> Also, how come you put response attributes on the request when using a
>>> renderer?
>>>
>>> How about a RenderResponse object:
>>>
>>> class RenderResponse(dict):
>>>
>>> def __init__(self):
>>> super(dict,self).__init__()
>>> self.content_type = 'the default'
>>> self.header_list = []
>>> self.status = '200 Ok' # or whatever...
>>> self.charset = 'utf-8'
>>> self.cache_for = 0
>>>
>>> ...then in you view you could just do:
>>>
>>> from repoze.bfg.view import bfg_view
>>> from repoze.somewhere import RenderResponse
>>>
>>> @bfg_view(name='gone',renderer='templates/gone.pt')
>>> def myview(request):
>>> response = Response(URL=request.URL)
>>> response.status = '404 Not Found'
>>> return response
>>>
>>> The view code wouldn't change and you wouldn't have to pollute the
>>> request...
>>
>> Could have been, too late now.
>
> How about for 1.4?

I'm not much in love with it, but I'd probably accept a patch.

- C
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to