当前位置: 首页>>代码示例>>Python>>正文


Python Serializer.create方法代码示例

本文整理汇总了Python中indico.web.http_api.metadata.serializer.Serializer.create方法的典型用法代码示例。如果您正苦于以下问题:Python Serializer.create方法的具体用法?Python Serializer.create怎么用?Python Serializer.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在indico.web.http_api.metadata.serializer.Serializer的用法示例。


在下文中一共展示了Serializer.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
 def _process(self):
     filename = "%s-Categ.atom" % self._target.getName().replace("/", "")
     hook = CategoryEventHook({'from': 'today'}, 'categ', {'idlist': self._target.getId(), 'dformat': 'atom'})
     res = hook(self.getAW())
     resultFossil = {'results': res[0], 'url': str(self._uh.getURL(self._target))}
     serializer = Serializer.create('atom')
     return send_file(filename, StringIO(serializer(resultFossil)), 'ATOM')
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:9,代码来源:categoryDisplay.py

示例2: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    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())
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        return send_file(filename, StringIO(serializer(resultFossil)), 'ICAL')
开发者ID:jacquesd,项目名称:indico,代码行数:11,代码来源:sessionDisplay.py

示例3: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    def _process(self):
        filename = "%s-Event.ics" % self._target.getTitle()

        hook = CategoryEventHook({'detail': self._detailLevel}, 'event',
                                 {'idlist': self._conf.getId(), 'dformat': 'ics'})
        res = hook(self.getAW())
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        return send_file(filename, StringIO(serializer(resultFossil)), 'ICAL')
开发者ID:MichelCordeiro,项目名称:indico,代码行数:12,代码来源:conferenceDisplay.py

示例4: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    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())
        resultFossil = {'results': res[0]}

        serializer = Serializer.create('ics')
        return send_file(filename, StringIO(serializer(resultFossil)), 'ICAL')
开发者ID:ferhatelmas,项目名称:indico,代码行数:15,代码来源:contribDisplay.py

示例5: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    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
开发者ID:vstitches,项目名称:indico,代码行数:16,代码来源:categoryDisplay.py

示例6: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    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
开发者ID:jt1,项目名称:indico,代码行数:16,代码来源:categoryDisplay.py

示例7: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    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
开发者ID:VishrutMehta,项目名称:indico,代码行数:18,代码来源:sessionDisplay.py

示例8: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    def _process(self):

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

        filename = "{0}-Contribution.ics".format(self._target.getTitle())

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

        serializer = Serializer.create("ics")
        return send_file(filename, StringIO(serializer(resultFossil)), "ICAL")
开发者ID:MichelCordeiro,项目名称:indico,代码行数:21,代码来源:contribDisplay.py

示例9: _process

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
    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
开发者ID:vstitches,项目名称:indico,代码行数:22,代码来源:contribDisplay.py

示例10: schema

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
                    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:
            if not serializer.schemaless:
                # if our serializer has a specific schema (HTML, ICAL, etc...)
                # use JSON, since it is universal
                serializer = Serializer.create('json')

            result = fossilize(error)
        else:
            if serializer.encapsulate:
                result = fossilize(HTTPAPIResult(result, path, query, ts, complete, extra), IHTTPAPIExportResultFossil)
                del result['_fossil']

        try:
            data = serializer(result)
            serializer.set_headers(req)
开发者ID:jt1,项目名称:indico,代码行数:34,代码来源:handlers.py

示例11: schema

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
                    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 request.method == 'POST':
            logger.info('API request: %s?%s' % (path, query))

        serializer = Serializer.create(dformat, pretty=pretty, typeMap=typeMap,
                                       **queryParams)
        if error:
            if not serializer.schemaless:
                # if our serializer has a specific schema (HTML, ICAL, etc...)
                # use JSON, since it is universal
                serializer = Serializer.create('json')

            result = fossilize(error)
        else:
            if serializer.encapsulate:
                result = fossilize(HTTPAPIResult(result, path, query, ts, complete, extra), IHTTPAPIExportResultFossil)
                del result['_fossil']

        try:
            data = serializer(result)
            serializer.set_headers(responseUtil)
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:34,代码来源:handlers.py

示例12: normalizeQuery

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
        if ak and error is None:
            # Commit only if there was an API key and no error
            norm_path, norm_query = normalizeQuery(path, query, remove=('signature', 'timestamp'), separate=True)
            uri = to_unicode('?'.join(filter(None, (norm_path, norm_query))))
            ak.register_used(request.remote_addr, uri, not onlyPublic)
            transaction.commit()
        else:
            # No need to commit stuff if we didn't use an API key (nothing was written)
            # XXX do we even need this?
            transaction.abort()

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

        serializer = Serializer.create(dformat, query_params=queryParams, pretty=pretty, typeMap=typeMap,
                                       **hook.serializer_args)
        if error:
            if not serializer.schemaless:
                # if our serializer has a specific schema (HTML, ICAL, etc...)
                # use JSON, since it is universal
                serializer = Serializer.create('json')

            result = fossilize(error)
        else:
            if serializer.encapsulate:
                result = fossilize(HTTPAPIResult(result, path, query, ts, complete, extra), IHTTPAPIExportResultFossil)
                del result['_fossil']

        try:
            data = serializer(result)
            serializer.set_headers(responseUtil)
开发者ID:marcosmolla,项目名称:indico,代码行数:34,代码来源:handlers.py

示例13: get_session_ical_file

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
def get_session_ical_file(sess):
    from indico.web.http_api.metadata.serializer import Serializer
    data = {'results': serialize_session_for_ical(sess) if sess.start_dt and sess.end_dt else []}
    serializer = Serializer.create('ics')
    return BytesIO(serializer(data))
开发者ID:DirkHoffmann,项目名称:indico,代码行数:7,代码来源:util.py

示例14: get_contribution_ical_file

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
def get_contribution_ical_file(contrib):
    data = {'results': serialize_contribution_for_ical(contrib)}
    serializer = Serializer.create('ics')
    return BytesIO(serializer(data))
开发者ID:DirkHoffmann,项目名称:indico,代码行数:6,代码来源:util.py

示例15: schema

# 需要导入模块: from indico.web.http_api.metadata.serializer import Serializer [as 别名]
# 或者: from indico.web.http_api.metadata.serializer.Serializer import create [as 别名]
                except ConflictError:
                    pass  # retry
                else:
                    break
        else:
            # No need to commit stuff if we didn't use an API key
            # (nothing was written)
            dbi.endRequest(False)

        LDAPConnector.destroy()

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

        serializer = Serializer.create(dformat, pretty=pretty, typeMap=typeMap,
                                       **hook.serializer_args)
        if error:
            if not serializer.schemaless:
                # if our serializer has a specific schema (HTML, ICAL, etc...)
                # use JSON, since it is universal
                serializer = Serializer.create('json')

            result = fossilize(error)
        else:
            if serializer.encapsulate:
                result = fossilize(HTTPAPIResult(result, path, query, ts, complete, extra), IHTTPAPIExportResultFossil)
                del result['_fossil']

        try:
            data = serializer(result)
            serializer.set_headers(responseUtil)
开发者ID:sofian86,项目名称:indico-gh-test,代码行数:34,代码来源:handlers.py


注:本文中的indico.web.http_api.metadata.serializer.Serializer.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。