Beispiel #1
0
    def _process(self):

        if not self._target.isScheduled():
            raise NoReportError(
                _("You cannot export the contribution with id %s because it is not scheduled"
                  ) % self._target.getId())

        filename = "%s-Contribution.ics" % self._target.getTitle()

        hook = ContributionHook({}, 'contribution', {
            'event': self._conf.getId(),
            'idlist': self._contrib.getId(),
            'dformat': 'ics'
        })
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        data = serializer(resultFossil)

        self._req.headers_out["Content-Length"] = "%s" % len(data)
        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType("ICAL")
        self._req.content_type = """%s""" % (mimetype)
        self._req.headers_out[
            "Content-Disposition"] = """inline; filename="%s\"""" % cleanHTMLHeaderFilename(
                filename)
        return data
Beispiel #2
0
    def _process( self ):

        hook = CategoryEventHook({'from': ['today']}, 'categ', {'idlist':self._target.getId(), 'dformat': 'atom'})
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0], 'url': str(self._uh.getURL(self._target))}

        serializer = Serializer.create('atom')
        data = serializer(resultFossil)

        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType( "ATOM" )
        self._req.content_type = """%s"""%(mimetype)

        return data
Beispiel #3
0
    def _process( self ):
        filename = "%s-Session.ics"%self._session.getTitle()

        hook = SessionHook({}, 'session', {'event': self._conf.getId(), 'idlist':self._session.getId(), 'dformat': 'ics'})
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        data = serializer(resultFossil)

        self._req.headers_out["Content-Length"] = "%s"%len(data)
        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType( "ICAL" )
        self._req.content_type = """%s"""%(mimetype)
        self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%filename.replace("\r\n"," ")
        return data
Beispiel #4
0
    def _process( self ):
        filename = "%s-Session.ics"%self._session.getTitle()

        hook = SessionHook({}, 'session', {'event': self._conf.getId(), 'idlist':self._session.getId(), 'dformat': 'ics'})
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        data = serializer(resultFossil)

        self._req.headers_out["Content-Length"] = "%s"%len(data)
        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType( "ICAL" )
        self._req.content_type = """%s"""%(mimetype)
        self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%cleanHTMLHeaderFilename(filename)
        return data
Beispiel #5
0
    def _process( self ):
        filename = "%s-Categ.ics"%self._target.getName().replace("/","")

        hook = CategoryEventHook({}, 'categ', {'idlist':self._target.getId(), 'dformat': 'ics'})
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        data = serializer(resultFossil)

        self._req.headers_out["Content-Length"] = "%s"%len(data)
        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType( "ICAL" )
        self._req.content_type = """%s"""%(mimetype)
        self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%cleanHTMLHeaderFilename(filename)

        return data
Beispiel #6
0
    def _process( self ):

        if not self._target.isScheduled():
            raise NoReportError(_("You cannot export the contribution with id %s because it is not scheduled")%self._target.getId())

        filename = "%s-Contribution.ics"%self._target.getTitle()

        hook = ContributionHook({}, 'contribution', {'event': self._conf.getId(), 'idlist':self._contrib.getId(), 'dformat': 'ics'})
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        data = serializer(resultFossil)

        self._req.headers_out["Content-Length"] = "%s"%len(data)
        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType( "ICAL" )
        self._req.content_type = """%s"""%(mimetype)
        self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%filename.replace("\r\n"," ")
        return data
Beispiel #7
0
    def _process(self):

        hook = CategoryEventHook({'from': ['today']}, 'categ', {
            'idlist': self._target.getId(),
            'dformat': 'atom'
        })
        res = hook(self.getAW(), self._req)
        resultFossil = {
            'results': res[0],
            'url': str(self._uh.getURL(self._target))
        }

        serializer = Serializer.create('atom')
        data = serializer(resultFossil)

        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType("ATOM")
        self._req.content_type = """%s""" % (mimetype)

        return data
Beispiel #8
0
    def _process(self):
        filename = "%s-Categ.ics" % self._target.getName().replace("/", "")

        hook = CategoryEventHook({}, 'categ', {
            'idlist': self._target.getId(),
            'dformat': 'ics'
        })
        res = hook(self.getAW(), self._req)
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        data = serializer(resultFossil)

        self._req.headers_out["Content-Length"] = "%s" % len(data)
        cfg = Config.getInstance()
        mimetype = cfg.getFileTypeMimeType("ICAL")
        self._req.content_type = """%s""" % (mimetype)
        self._req.headers_out[
            "Content-Disposition"] = """inline; filename="%s\"""" % cleanHTMLHeaderFilename(
                filename)

        return data
Beispiel #9
0
                else:
                    break
        else:
            # No need to commit stuff if we didn't use an API key
            # (nothing was written)
            if minfo.getRoomBookingModuleActive():
                Factory.getDALManager().rollback()
                Factory.getDALManager().disconnect()
            dbi.endRequest(False)

        # Log successful POST api requests
        if error is None and req.method == 'POST':
            logger.info('API request: %s?%s' % (path, query))

        serializer = Serializer.create(dformat,
                                       pretty=pretty,
                                       typeMap=typeMap,
                                       **remove_lists(queryParams))

        if error:
            resultFossil = fossilize(error)
        else:
            iface = None
            if mode == 'export':
                iface = IHTTPAPIExportResultFossil
            resultFossil = fossilize(
                HTTPAPIResult(result, path, query, ts, complete, extra), iface)

        del resultFossil['_fossil']

        try:
Beispiel #10
0
                    pass # retry
                else:
                    break
        else:
            # No need to commit stuff if we didn't use an API key
            # (nothing was written)
            if minfo.getRoomBookingModuleActive():
                Factory.getDALManager().rollback()
                Factory.getDALManager().disconnect()
            dbi.endRequest(False)

        # Log successful POST api requests
        if error is None and req.method == 'POST':
            logger.info('API request: %s?%s' % (path, query))

        serializer = Serializer.create(dformat, pretty=pretty, typeMap=typeMap,
                                       **remove_lists(queryParams))

        if error:
            resultFossil = fossilize(error)
        else:
            iface = None
            if mode == 'export':
                iface = IHTTPAPIExportResultFossil
            resultFossil = fossilize(HTTPAPIResult(result, path, query, ts, complete, extra), iface)

        del resultFossil['_fossil']

        try:

            if error and not serializer.schemaless:
                # if our serializer has a specific schema (HTML, ICAL, etc...)