Exemple #1
0
 def link(self):
     """ Download link
     """
     if not self._link:
         storage = IStorage(self.context).of("epub")
         self._link = storage.absolute_url()
     return self._link
Exemple #2
0
 def link(self):
     """ Download link
     """
     if not self._link:
         storage = IStorage(self.context).of('pdf')
         self._link = storage.absolute_url()
     return self._link
Exemple #3
0
    def download(self, email='', **kwargs):
        """ Download
        """
        # PDF already generated
        storage = IStorage(self.context).of('pdf')
        filepath = storage.filepath()
        fileurl = storage.absolute_url()
        url = self.context.absolute_url()
        title = self.context.title_or_id()

        portal = getSite()
        from_name = portal.getProperty('email_from_name')
        from_email = portal.getProperty('email_from_address')

        if async .file_exists(filepath):
            wrapper = async .ContextWrapper(self.context)(
                fileurl=fileurl,
                filepath=filepath,
                email=email,
                url=url,
                from_name=from_name,
                from_email=from_email,
                title=title)

            event.notify(AsyncPDFExportSuccess(wrapper))
            return self.finish(email=email)
Exemple #4
0
 def flushPDFsCache(self):
     """ Flush all PDFs cache for this theme
     """
     catalog = getToolByName(self.context, 'portal_catalog')
     for brain in catalog.searchResults(portal_type=self.types):
         obj = brain.getObject()
         storage = IStorage(obj).of('pdf')
         storage_pdf_obj = obj.unrestrictedTraverse(
             storage.absolute_url(True), None)
         #change modification time only if
         #the object has a PDF generated in downloads
         if storage_pdf_obj is not None:
             updateContext(obj)
     return json.dumps('ok')
Exemple #5
0
 def flushPDFsCache(self):
     """ Flush all PDFs cache for this theme
     """
     catalog = getToolByName(self.context, 'portal_catalog')
     for brain in catalog.searchResults(portal_type=self.types):
         obj = brain.getObject()
         storage = IStorage(obj).of('pdf')
         storage_pdf_obj = obj.unrestrictedTraverse(
             storage.absolute_url(True), None)
         #change modification time only if
         #the object has a PDF generated in downloads
         if storage_pdf_obj is not None:
             updateContext(obj)
     return json.dumps('ok')
Exemple #6
0
 def link(self):
     """ Download link
     """
     storage = IStorage(self.context).of('pdf')
     return storage.absolute_url()