ops scuse/excuse

2010/2/6 Miuler <miu...@gmail.com>

> Thanks Chris, and scuse me for email in spanish
>
> 2010/2/6 Chris McDonough <chr...@plope.com>
>
> <
>> http://docs.repoze.org/bfg/1.2/narr/views.html#varying-attributes-of-rendered-responses
>> >
>>
>>
>> class ReportXmlView(object):
>>    def __init__(self, context, request):
>>        self.context = context
>>        self.request = request
>>
>>    def __call__(self):
>>        self.request.response_content_type = 'text/xml'
>>        return {}
>>
>>
>> <view
>>   name="report.xml"
>>   for="*"
>>   view=".view.ReportXmlView"
>>   renderer="report.pt"
>>   />
>>
>>
>>
>> On 2/6/10 12:03 PM, Miuler wrote:
>>
>>> (http://paste.pocoo.org/show/04xY0CQb2YpOy3gMGSFy/)
>>>
>>> Hola, tengo una clase vista la cual me proporciona los m├ętodos para la
>>> plantilla:
>>>
>>> class ReportXmlView(object):
>>>     def __init__(self, context, request):
>>>         self.context = context
>>>         self.request = request
>>>
>>>     def __call__(self):
>>>         return {}
>>>
>>>     def getReportsFromDB(self):
>>> """example"""
>>>         id_user = self.request.params['id_user']
>>>         reports = [1,2,3,4,5]
>>>
>>> lo tengo todo configurado con zcml de la siguiente manera
>>> <view
>>>   name="report.xml"
>>>   for="*"
>>>   view=".view.ReportXmlView"
>>>   renderer="report.xml.pt <http://report.xml.pt>"
>>>
>>>   />
>>>
>>> Pero esto me retorna content type text/html, y yo quiero que retorne un
>>> text/xml
>>> He intentado poner esto:
>>> <view
>>>   name="report.xml"
>>>   for="*"
>>>   view=".view.ReportXmlView"
>>>   renderer="report.xml.pt <http://report.xml.pt>"
>>>
>>>   header="Content-Type:text/xml"
>>>   />
>>>
>>> Pero no funciona, como puedo hacer para que retorne un type "text/xml"
>>> mediante zcml??
>>>
>>> Por el momento he quitado y lo he puesto por codigo
>>>
>>> class ReportXmlView(object):
>>>     def __init__(self, context, request):
>>>         self.context = context
>>>         self.request = request
>>>
>>>     def __call__(self):
>>>         response = render_template_to_response('report.xml.pt
>>> <http://report.xml.pt>', view=self)
>>>
>>>         response.content_type = 'text/xml'
>>>         return response
>>>
>>>     def getReportsFromDB(self):
>>> """example"""
>>>         id_user = self.request.params['id_user']
>>>         reports = [1,2,3,4,5]
>>>
>>> <view
>>>   name="report.xml"
>>>   for="*"
>>>   view=".view.ReportXmlView"
>>>   />
>>>
>>>
>>>
>>> _______________________________________________
>>> Repoze-dev mailing list
>>> Repoze-dev@lists.repoze.org
>>> http://lists.repoze.org/listinfo/repoze-dev
>>>
>>
>>
>> --
>> The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book
>>
>
>
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to