def pdf(self, value): """ Invalidate last generated PDF? """ if not value: return updateContext(self.context) if value.get("relatedItems"): updateRelatedItems(self.context) if value.get("backRefs"): updateBackRefs(self.context)
def pdf(self, value): """ Invalidate last generated PDF? """ if not value: return updateContext(self.context) if value.get('relatedItems'): updateRelatedItems(self.context) if value.get('backRefs'): updateBackRefs(self.context)
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')