Пример #1
0
    def test_context_manager_adds_book_layers(self):
        thelist = list(directlyProvidedBy(self.portal.REQUEST))

        with providing_book_layers(self.portal, self.portal.REQUEST):
            diff = [it for it in list(
                    directlyProvidedBy(self.portal.REQUEST)) if it not in thelist]

            self.assertEquals(
                ['<InterfaceClass ftw.book.interfaces.IWithinBookLayer>'],
                [str(item) for item in diff])

        self.assertEquals(thelist,
                          list(directlyProvidedBy(self.portal.REQUEST)))
Пример #2
0
    def test_context_manager_adds_book_layers(self):
        thelist = list(directlyProvidedBy(self.portal.REQUEST))

        with providing_book_layers(self.portal, self.portal.REQUEST):
            diff = [
                it for it in list(directlyProvidedBy(self.portal.REQUEST))
                if it not in thelist
            ]

            self.assertEquals(
                ['<InterfaceClass ftw.book.interfaces.IWithinBookLayer>'],
                [str(item) for item in diff])

        self.assertEquals(thelist,
                          list(directlyProvidedBy(self.portal.REQUEST)))
Пример #3
0
    def get_files(self, path_prefix=u"", recursive=True, toplevel=True):
        filename = '{0}.pdf'.format(self.context.getId())

        with providing_book_layers(self.context, self.request):
            assembler = getMultiAdapter((self.context, self.request),
                                        IPDFAssembler)

            yield (u'{0}/{1}'.format(safe_unicode(path_prefix),
                                     safe_unicode(filename)),
                   StringIO(assembler.build_pdf()))

            folder_contents = super(BookZipRepresentation, self).get_files(
                path_prefix, recursive, toplevel)

            for item in folder_contents:
                yield item
Пример #4
0
    def get_files(self, path_prefix=u"", recursive=True, toplevel=True):
        filename = '{0}.pdf'.format(self.context.getId())

        with providing_book_layers(self.context, self.request):
            assembler = getMultiAdapter((self.context, self.request),
                                        IPDFAssembler)

            yield (u'{0}/{1}'.format(safe_unicode(path_prefix),
                                     safe_unicode(filename)),
                   StringIO(assembler.build_pdf()))

            folder_contents = super(BookZipRepresentation,
                                    self).get_files(path_prefix, recursive,
                                                    toplevel)

            for item in folder_contents:
                yield item