def _process(self):
     set_best_lang()  # prevents from having a _LazyString when generating a pdf without session.lang set
     tz = timezoneUtils.DisplayTZ(self._aw, self._target).getDisplayTZ()
     filename = "%s - Programme.pdf" % self._target.getTitle()
     from MaKaC.PDFinterface.conference import ProgrammeToPDF
     pdf = ProgrammeToPDF(self._target, tz=tz)
     return send_file(filename, StringIO(pdf.getPDFBin()), 'PDF')
 def _process(self):
     set_best_lang()  # prevents from having a _LazyString when generating a pdf without session.lang set
     tz = timezoneUtils.DisplayTZ(self._aw, self._target).getDisplayTZ()
     filename = "%s - Programme.pdf" % self._target.getTitle()
     from MaKaC.PDFinterface.conference import ProgrammeToPDF
     pdf = ProgrammeToPDF(self._target, tz=tz)
     return send_file(filename, StringIO(pdf.getPDFBin()), 'PDF')
Beispiel #3
0
 def _process( self ):
     set_best_lang()  # prevents from having a _LazyString when generating a pdf without session.lang set
     if self._addNew:
         self._redirect(RHRegistrantNewForm._uh.getURL(self._conf))
     elif self._remove:
         if len(self._selectedRegistrants)>0:
             wp = registrants.WPRegistrantModifRemoveConfirmation(self, self._conf, self._selectedRegistrants)
             return wp.display()
         else:
             self._redirect(urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
     elif self._email:
         r = RHRegistrantListEmail(self, self._conf,self._reglist)
         return r.email()
     elif self._emailSelected:
         if len(self._selectedRegistrants)>0:
             r = RHRegistrantListEmail(self, self._conf,self._selectedRegistrants)
             return r.email()
         else:
             self._redirect(urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
     elif self._tablePDF:
         regs =[]
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantListPDF(self,self._conf,regs, self._display)
         return r.pdf()
     elif self._bookPDF:
         regs =[]
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantBookPDF(self,self._conf,regs, self._display)
         return r.pdf()
     elif self._excel:
         regs =[]
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantListExcel(self,self._conf,regs, self._display, self._windowsAgent)
         return r.excel()
     elif self._printBadgesSelected:
         if len(self._selectedRegistrants) > 0:
             wp = registrants.WPRegistrantModifPrintBadges(self, self._conf, self._selectedRegistrants)
             return wp.display()
         else:
             self._redirect(urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
     elif self._package:
         regs =[]
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantPackage(self, self._conf,regs)
         return r.pack()
     else:
         self._redirect(urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
Beispiel #4
0
    def _process(self):
        set_best_lang(
        )  # prevents from having a _LazyString when generating a pdf without session.lang set
        tz = timezoneUtils.DisplayTZ(self._aw, self._target).getDisplayTZ()
        params = self._getRequestParams()
        ttPDFFormat = TimetablePDFFormat(params)

        # Choose action depending on the button pressed
        if params.has_key("cancel"):
            # If the export is cancelled, redirect to the display
            # page
            url = urlHandlers.UHConferenceDisplay.getURL(self._conf)
            url.addParam("view", self._view)
            self._redirect(url)
        else:
            retry = True
            while retry:
                if params.get("typeTT", "normalTT") == "normalTT":
                    filename = "timetable.pdf"
                    pdf = TimeTablePlain(
                        self._target,
                        self.getAW(),
                        showSessions=self._showSessions,
                        showDays=self._showDays,
                        sortingCrit=self._sortingCrit,
                        ttPDFFormat=ttPDFFormat,
                        pagesize=self._pagesize,
                        fontsize=self._fontsize,
                        firstPageNumber=self._firstPageNumber,
                        showSpeakerAffiliation=self._showSpeakerAffiliation)
                else:
                    filename = "SimplifiedTimetable.pdf"
                    pdf = SimplifiedTimeTablePlain(
                        self._target,
                        self.getAW(),
                        showSessions=self._showSessions,
                        showDays=self._showDays,
                        sortingCrit=self._sortingCrit,
                        ttPDFFormat=ttPDFFormat,
                        pagesize=self._pagesize,
                        fontsize=self._fontsize)
                try:
                    data = pdf.getPDFBin()
                    retry = False
                except LayoutError, e:
                    if not self._reduceFontSize():
                        raise MaKaCError(
                            "Error in PDF generation - One of the paragraphs does not fit on a page"
                        )
                except Exception:
                    raise
Beispiel #5
0
 def before_request(self, *args, **kwargs):
     super(IndicoSentry, self).before_request()
     if not has_request_context():
         return
     self.client.extra_context({'Endpoint': str(request.url_rule.endpoint) if request.url_rule else None,
                                'Request ID': request.id})
     self.client.tags_context({'locale': set_best_lang()})
Beispiel #6
0
 def lang(self):
     if '_lang' in self:
         # explicit language set in the session
         return self['_lang']
     else:
         # guess language based on accept-languages or use default
         return set_best_lang(check_session=False)
Beispiel #7
0
 def before_request(self, *args, **kwargs):
     super(IndicoSentry, self).before_request()
     if not has_request_context():
         return
     self.client.extra_context({'Endpoint': str(request.url_rule.endpoint) if request.url_rule else None,
                                'Request ID': request.id})
     self.client.tags_context({'locale': set_best_lang()})
Beispiel #8
0
 def lang(self):
     if '_lang' in self:
         # explicit language set in the session
         return self['_lang']
     else:
         # guess language based on accept-languages or use default
         return set_best_lang(check_session=False)
    def _process(self):
        set_best_lang()  # prevents from having a _LazyString when generating a pdf without session.lang set
        tz = timezoneUtils.DisplayTZ(self._aw,self._target).getDisplayTZ()
        params = self._getRequestParams()
        ttPDFFormat=TimetablePDFFormat(params)

        # Choose action depending on the button pressed
        if params.has_key("cancel"):
            # If the export is cancelled, redirect to the display
            # page
            url = urlHandlers.UHConferenceDisplay.getURL(self._conf)
            url.addParam("view", self._view)
            self._redirect(url)
        else :
            retry = True
            while retry:
                if params.get("typeTT","normalTT")=="normalTT":
                    filename = "timetable.pdf"
                    pdf = TimeTablePlain(self._target,self.getAW(),
                            showSessions=self._showSessions,showDays=self._showDays,
                            sortingCrit=self._sortingCrit, ttPDFFormat=ttPDFFormat,
                            pagesize = self._pagesize, fontsize = self._fontsize,
                            firstPageNumber = self._firstPageNumber,
                            showSpeakerAffiliation = self._showSpeakerAffiliation)
                else:
                    filename = "SimplifiedTimetable.pdf"
                    pdf = SimplifiedTimeTablePlain(self._target,self.getAW(),
                        showSessions=self._showSessions,showDays=self._showDays,
                        sortingCrit=self._sortingCrit, ttPDFFormat=ttPDFFormat,
                        pagesize = self._pagesize, fontsize = self._fontsize)
                try:
                    data=pdf.getPDFBin()
                    retry = False
                except LayoutError, e:
                    if not self._reduceFontSize():
                        raise MaKaCError("Error in PDF generation - One of the paragraphs does not fit on a page")
                except Exception:
                    raise
Beispiel #10
0
 def _process(self):
     set_best_lang()  # prevents from having a _LazyString when generating a pdf without session.lang set
     filename = "{0}-Ticket.pdf".format(self._target.getTitle())
     pdf = TicketToPDF(self._target, self._registrant)
     return send_file(filename, StringIO(pdf.getPDFBin()), 'PDF')
 def lang(self):
     return self.get('_lang') or set_best_lang(check_session=False)
Beispiel #12
0
def _set_request_info():
    sentry_sdk.set_extra(
        'Endpoint',
        str(request.url_rule.endpoint) if request.url_rule else None)
    sentry_sdk.set_extra('Request ID', request.id)
    sentry_sdk.set_tag('locale', set_best_lang())
Beispiel #13
0
 def _process(self):
     set_best_lang(
     )  # prevents from having a _LazyString when generating a pdf without session.lang set
     if self._addNew:
         self._redirect(RHRegistrantNewForm._uh.getURL(self._conf))
     elif self._remove:
         if len(self._selectedRegistrants) > 0:
             wp = registrants.WPRegistrantModifRemoveConfirmation(
                 self, self._conf, self._selectedRegistrants)
             return wp.display()
         else:
             self._redirect(
                 urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
     elif self._email:
         r = RHRegistrantListEmail(self, self._conf, self._reglist)
         return r.email()
     elif self._emailSelected:
         if len(self._selectedRegistrants) > 0:
             r = RHRegistrantListEmail(self, self._conf,
                                       self._selectedRegistrants)
             return r.email()
         else:
             self._redirect(
                 urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
     elif self._tablePDF:
         regs = []
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantListPDF(self, self._conf, regs, self._display)
         return r.pdf()
     elif self._bookPDF:
         regs = []
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantBookPDF(self, self._conf, regs, self._display)
         return r.pdf()
     elif self._excel:
         regs = []
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantListExcel(self, self._conf, regs, self._display,
                                   self._windowsAgent)
         return r.excel()
     elif self._printBadgesSelected:
         if len(self._selectedRegistrants) > 0:
             wp = registrants.WPRegistrantModifPrintBadges(
                 self, self._conf, self._selectedRegistrants)
             return wp.display()
         else:
             self._redirect(
                 urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
     elif self._package:
         regs = []
         for reg in self._selectedRegistrants:
             if self._conf.getRegistrantById(reg) != None:
                 regs.append(self._conf.getRegistrantById(reg))
         r = RHRegistrantPackage(self, self._conf, regs)
         return r.pack()
     else:
         self._redirect(
             urlHandlers.UHConfModifRegistrantList.getURL(self._conf))
Beispiel #14
0
 def lang(self):
     return self.get('_lang') or set_best_lang(check_session=False)