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


Python FormatterError.nitfFormatterError方法代码示例

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


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

示例1: format

# 需要导入模块: from superdesk.errors import FormatterError [as 别名]
# 或者: from superdesk.errors.FormatterError import nitfFormatterError [as 别名]
    def format(self, article, subscriber, codes=None):
        try:
            pub_seq_num = superdesk.get_resource_service('subscribers').generate_sequence_number(subscriber)

            nitf = self.get_nitf(article, subscriber, pub_seq_num)
            return [(pub_seq_num, self.XML_ROOT + etree.tostring(nitf).decode('utf-8'))]
        except Exception as ex:
            raise FormatterError.nitfFormatterError(ex, subscriber)
开发者ID:liveblog,项目名称:superdesk-core,代码行数:10,代码来源:nitf_formatter.py

示例2: format

# 需要导入模块: from superdesk.errors import FormatterError [as 别名]
# 或者: from superdesk.errors.FormatterError import nitfFormatterError [as 别名]
    def format(self, article, destination, selector_codes=None):
        try:

            pub_seq_num = superdesk.get_resource_service('output_channels').generate_sequence_number(destination)

            nitf = self.get_nitf(article, destination, pub_seq_num)

            return pub_seq_num, self.XML_ROOT + etree.tostring(nitf).decode('utf-8')
        except Exception as ex:
            raise FormatterError.nitfFormatterError(ex, destination)
开发者ID:Flowdeeps,项目名称:superdesk-1,代码行数:12,代码来源:nitf_formatter.py

示例3: format

# 需要导入模块: from superdesk.errors import FormatterError [as 别名]
# 或者: from superdesk.errors.FormatterError import nitfFormatterError [as 别名]
    def format(self, article, subscriber, codes=None):
        try:
            pub_seq_num = superdesk.get_resource_service('subscribers').generate_sequence_number(subscriber)

            nitf = self.get_nitf(article, subscriber, pub_seq_num)
            return [{'published_seq_num': pub_seq_num,
                     'formatted_item': etree.tostring(nitf, encoding='ascii').decode('ascii'),
                    'item_encoding': 'ascii'}]
        except Exception as ex:
            raise FormatterError.nitfFormatterError(ex, subscriber)
开发者ID:marwoodandrew,项目名称:superdesk-aap,代码行数:12,代码来源:aap_nitf_formatter.py

示例4: format

# 需要导入模块: from superdesk.errors import FormatterError [as 别名]
# 或者: from superdesk.errors.FormatterError import nitfFormatterError [as 别名]
 def format(self, article, subscriber, codes=None):
     try:
         pub_seq_num = superdesk.get_resource_service('subscribers').generate_sequence_number(subscriber)
         nitf = self.get_nitf(article, subscriber, pub_seq_num)
         strip_elements(nitf, 'body.end')
         nitf_string = etree.tostring(nitf, encoding='utf-8').decode()
         headers = ['<?xml version=\"1.0\" encoding=\"UTF-8\"?>',
                    '<!-- <!DOCTYPE nitf SYSTEM \"./nitf-3-3.dtd\"> -->']
         return [{
             'published_seq_num': pub_seq_num,
             'formatted_item': '{}\r\n{}'.format("\r\n".join(headers), nitf_string).
                 replace('&#13;\n', self.line_ender)}]
     except Exception as ex:
         raise FormatterError.nitfFormatterError(ex, subscriber)
开发者ID:mdhaman,项目名称:superdesk-aap,代码行数:16,代码来源:iress_nitf_formatter.py

示例5: format

# 需要导入模块: from superdesk.errors import FormatterError [as 别名]
# 或者: from superdesk.errors.FormatterError import nitfFormatterError [as 别名]
 def format(self, article, destination):
     try:
         nitf = etree.Element("nitf")
         head = SubElement(nitf, "head")
         body = SubElement(nitf, "body")
         body_head = SubElement(body, "body.head")
         body_content = SubElement(body, "body.content")
         body_content.text = article['body_html']
         body_end = SubElement(body, "body.end")
         etree.Element('doc-id', attrib={'id-string': article['guid']})
         self.__format_head(article, head)
         self.__format_body_head(article, body_head)
         self.__format_body_end(article, body_end)
         return self.XML_ROOT + str(etree.tostring(nitf))
     except Exception as ex:
         raise FormatterError.nitfFormatterError(ex, destination)
开发者ID:girgen79,项目名称:superdesk,代码行数:18,代码来源:nitf_formatter.py

示例6: format

# 需要导入模块: from superdesk.errors import FormatterError [as 别名]
# 或者: from superdesk.errors.FormatterError import nitfFormatterError [as 别名]
    def format(self, article, destination, selector_codes=None):
        try:

            pub_seq_num = superdesk.get_resource_service('output_channels').generate_sequence_number(destination)

            nitf = etree.Element("nitf")
            head = SubElement(nitf, "head")
            body = SubElement(nitf, "body")
            body_head = SubElement(body, "body.head")
            body_content = SubElement(body, "body.content")
            body_content.text = article['body_html']
            body_end = SubElement(body, "body.end")

            etree.Element('doc-id', attrib={'id-string': article['guid']})

            self.__append_meta(article, head, destination, pub_seq_num)
            self.__format_head(article, head)
            self.__format_body_head(article, body_head)
            self.__format_body_end(article, body_end)

            return pub_seq_num, self.XML_ROOT + str(etree.tostring(nitf))
        except Exception as ex:
            raise FormatterError.nitfFormatterError(ex, destination)
开发者ID:jey07ro,项目名称:superdesk,代码行数:25,代码来源:nitf_formatter.py


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