Several /@@asPDF views for same content [SOLVED]

Is it possible to make several asPDF views with Produce&Publish for the same content ?

I have one view that converts to 'one page', and one that makes 'one page for each users (so the same as the other, it just includes the name).

I was hoping for something like




Where one would use template '' and the other ''

PS: Currently I use plone.api to get the users, so I don't think I can do the looping in TAL. Please correct me if I am wrong.

This is likely possibly by writing a dispatcher view that dispatches/redirects to dedicated views based on query/URL parameters. I have not looked into the particular part of my implementation, but within a brower view you can have either a rendering template associated through ZCML or by a configuration with the browser view Python class. The __call__() implementation has full access to the request and can instantiate a ViewPagetemplate with some arbitrary template based on URL parameters.

I did not figure out why I could not define the template inside call(), but this seems to work:

class PDFView(BrowserView):
""" Converter view for making PDF

    template = ViewPageTemplateFile('')
    template2 = ViewPageTemplateFile('')

    def __call__(self, *args, **kw):
        if hasattr(self.request, 'everybody'):
            self.template = self.template2

        return self.template(self.context)