def _processIfActive(self): tz = timezoneUtils.DisplayTZ(self._aw, self._conf).getDisplayTZ() cfaMgr = self._conf.getAbstractMgr() abstracts = cfaMgr.getAbstractListForAvatar(self._aw.getUser()) abstracts += cfaMgr.getAbstractListForAuthorEmail(self._aw.getUser().getEmail()) self._abstractIds = [abstract.getId() for abstract in abstracts] if not self._abstractIds: return _("No abstract to print") pdf = AbstractsToPDF(self._conf, self._abstractIds, tz=tz) return send_file("my-abstracts.pdf", StringIO(pdf.getPDFBin()), "PDF")
def _processIfActive(self): tz = timezoneUtils.DisplayTZ(self._aw, self._conf).getDisplayTZ() cfaMgr = self._conf.getAbstractMgr() abstracts = set(cfaMgr.getAbstractListForAvatar(self._aw.getUser())) abstracts |= set(cfaMgr.getAbstractListForAuthorEmail(self._aw.getUser().getEmail())) self._abstractIds = sorted(abstract.getId() for abstract in abstracts) if not self._abstractIds: return _("No abstract to print") filename = 'my-abstracts.pdf' pdf = AbstractsToPDF(self._conf, self._abstractIds, tz=tz) return send_file(filename, pdf.generate(), 'PDF')
def _process( self ): tz = timezoneUtils.DisplayTZ(self._aw,self._conf).getDisplayTZ() filename = "Abstracts.pdf" if not self._abstracts: return _("No abstract to print") pdf = AbstractsToPDF(self._conf, self._abstracts,tz=tz) data = pdf.getPDFBin() self._req.set_content_length(len(data)) cfg = Config.getInstance() mimetype = cfg.getFileTypeMimeType( "PDF" ) self._req.content_type = """%s"""%(mimetype) self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%filename return data
def _processIfActive(self): tz = timezoneUtils.DisplayTZ(self._aw, self._conf).getDisplayTZ() cfaMgr = self._conf.getAbstractMgr() abstracts = set(cfaMgr.getAbstractListForAvatar(self._aw.getUser())) abstracts |= set( cfaMgr.getAbstractListForAuthorEmail( self._aw.getUser().getEmail())) self._abstractIds = sorted(abstract.getId() for abstract in abstracts) if not self._abstractIds: return _("No abstract to print") filename = 'my-abstracts.pdf' pdf = AbstractsToPDF(self._conf, self._abstractIds, tz=tz) return send_file(filename, pdf.generate(), 'PDF')
def _process(self): tz = timezoneUtils.DisplayTZ(self._aw, self._conf).getDisplayTZ() filename = "Abstracts.pdf" if not self._abstracts: return _("No abstract to print") pdf = AbstractsToPDF(self._conf, self._abstracts, tz=tz) data = pdf.getPDFBin() self._req.set_content_length(len(data)) cfg = Config.getInstance() mimetype = cfg.getFileTypeMimeType("PDF") self._req.content_type = """%s""" % (mimetype) self._req.headers_out[ "Content-Disposition"] = """inline; filename="%s\"""" % filename return data
def _processIfActive( self ): tz = timezoneUtils.DisplayTZ(self._aw,self._conf).getDisplayTZ() cfaMgr = self._conf.getAbstractMgr() abstracts = cfaMgr.getAbstractListForAvatar( self._aw.getUser() ) abstracts += cfaMgr.getAbstractListForAuthorEmail(self._aw.getUser().getEmail()) self._abstractIds = [abstract.getId() for abstract in abstracts] if not self._abstractIds: return _("No abstract to print") filename = "Abstracts.pdf" pdf = AbstractsToPDF(self._conf, self._abstractIds,tz=tz) data = pdf.getPDFBin() self._req.set_content_length(len(data)) cfg = Config.getInstance() mimetype = cfg.getFileTypeMimeType( "PDF" ) self._req.content_type = """%s"""%(mimetype) self._req.headers_out["Content-Disposition"] = """inline; filename=%s"""%filename return data
def _processIfActive( self ): tz = timezoneUtils.DisplayTZ(self._aw,self._conf).getDisplayTZ() cfaMgr = self._conf.getAbstractMgr() abstracts = cfaMgr.getAbstractListForAvatar( self._aw.getUser() ) abstracts += cfaMgr.getAbstractListForAuthorEmail(self._aw.getUser().getEmail()) self._abstractIds = [abstract.getId() for abstract in abstracts] if not self._abstractIds: return _("No abstract to print") filename = "Abstracts.pdf" pdf = AbstractsToPDF(self._conf, self._abstractIds,tz=tz) data = pdf.getPDFBin() self._req.set_content_length(len(data)) cfg = Config.getInstance() mimetype = cfg.getFileTypeMimeType( "PDF" ) self._req.content_type = """%s"""%(mimetype) self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%filename return data
def _process(self): pdf = AbstractsToPDF(self.event_new, get_user_abstracts(self.event_new, session.user)) return send_file('my-abstracts.pdf', pdf.generate(), 'application/pdf')