Esempio n. 1
0
    def render(self, objects, output_encoding=None,
                     title_force_uppercase=False,
                     msdos_eol_style=False,
                     omit_fields_mapping={}):
        """ do it
        """
        if isinstance(objects, (list, tuple)):
            context = objects[0]
        else:
            context = objects

        if not IBibliographyExport.providedBy(context):
            try:
                context = context.aq_parent
            except AttributeError:
                pass

        source = BibtexRenderer().render(objects, title_force_uppercase=True)
        request = getattr(context, 'REQUEST', TestRequest())
        view = getMultiAdapter((context, request), name=u'reference.pdf')
        return view.processSource(source,
                                  title=title_or_id(context),
                                  url=absoluteURL(context, request))
 def __call__(self):
     # This check is completely bullshit: it does not take export
     # adapters into account nor does it work with the old-style
     # IBibliographyExport interface as used in base.py
     return IBibliographyExport.providedBy(self.context) or IBibliographicItem.providedBy(self.context)