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


Python TemplateAPI.set_error_message方法代码示例

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


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

示例1: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import set_error_message [as 别名]
    def __call__(self):
        """ Folder contents for the INetworkEvents marker"""
        context = self.context
        request = self.request

        page_title = context.title
        api = TemplateAPI(context, request, page_title)

        # Data for the filter bar, get the list of possible years and months
        this_year = datetime.datetime.now().year
        fb_years = [str(i) for i in range(2007, this_year + 1)]
        fb_months = [
            ("1", "January"),
            ("2", "February"),
            ("3", "March"),
            ("4", "April"),
            ("5", "May"),
            ("6", "June"),
            ("7", "July"),
            ("8", "August"),
            ("9", "September"),
            ("10", "October"),
            ("11", "November"),
            ("12", "December"),
        ]

        # Flatten the search results into ZPT data
        try:
            batch = self._get_batch()
        except ParseError, e:
            api.set_error_message("Error: %s" % e)
            batch = {"entries": (), "batching_required": False}
开发者ID:reebalazs,项目名称:karl,代码行数:34,代码来源:custom_folderviews.py

示例2: __call__

# 需要导入模块: from karl.views.api import TemplateAPI [as 别名]
# 或者: from karl.views.api.TemplateAPI import set_error_message [as 别名]
    def __call__(self):
        """ Folder contents for the INetworkEvents marker"""
        context = self.context
        request = self.request

        page_title = context.title
        api = TemplateAPI(context, request, page_title)

        # Data for the filter bar, get the list of possible years and months
        this_year = datetime.datetime.now().year
        fb_years = [str(i) for i in range(2007, this_year+1)]
        fb_months = [('1', 'January'), ('2', 'February'), ('3', 'March'),
                     ('4', 'April'), ('5', 'May'), ('6', 'June'),
                     ('7', 'July'), ('8', 'August'), ('9', 'September'),
                     ('10', 'October'), ('11', 'November'), ('12', 'December')]

        # Flatten the search results into ZPT data
        try:
            batch = self._get_batch()
        except ParseError, e:
            api.set_error_message('Error: %s' % e)
            batch = {'entries': (), 'batching_required': False}
开发者ID:hj91,项目名称:karl,代码行数:24,代码来源:custom_folderviews.py


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