def link(self): """ Download link """ if not self._link: storage = IStorage(self.context).of("epub") self._link = storage.absolute_url() return self._link
def link(self): """ Download link """ if not self._link: storage = IStorage(self.context).of('pdf') self._link = storage.absolute_url() return self._link
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)
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')
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')
def link(self): """ Download link """ storage = IStorage(self.context).of('pdf') return storage.absolute_url()