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


Python Portal._addHtml方法代码示例

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


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

示例1: __exportInclude

# 需要导入模块: from publica.core.portal import Portal [as 别名]
# 或者: from publica.core.portal.Portal import _addHtml [as 别名]
    def __exportInclude(self):
        """
        """
        portal = Portal(id_site=self.id_site,
                        request={"exportar":1})

        id_pagina = self.dados["pagina"]
        path = self.dados["path"]
        url = portal.getUrlByPagina(id_pagina=id_pagina,
                                    exportar=1,
                                    adm=1)

        source = urllib.urlopen(url).read()
        if source:

            source = source.split("morris-cut")
            if len(source) == 2:
                topo, rodape = source
                portal._addHtml(path=path,
                                filename="topo.html",
                                source=topo)
                portal._addHtml(path=path,
                                filename="rodape.html",
                                source=rodape)

                self.logmsg = ("Includes Morris "
                               "atualizados, site: %s.")  % self.id_site
                return "Includes criados"
            else:
                raise UserError(("A Página não é "
                                "um include Morris válido. "
                                "eg. morris-cut %s") % url)

        raise UserError(("Ocorreu um problema ao gerar os includes: "
                                "a página não retornou conteúdo"))
开发者ID:intip,项目名称:da-apps,代码行数:37,代码来源:plug.py

示例2: __exportInclude

# 需要导入模块: from publica.core.portal import Portal [as 别名]
# 或者: from publica.core.portal.Portal import _addHtml [as 别名]
    def __exportInclude(self):
        """
        """
        portal = Portal(id_site=self.id_site,
                        request=self.request)

        dados = portal._getApp(env_site=self.id_site,
                               schema=self.schema)

        id_pagina = dados["dados"]["pagina"]
        path = dados["dados"]["path"]
        url = portal.getUrlByPagina(id_pagina=id_pagina,
                                    exportar=1,
                                    adm=1)

        source = urllib.urlopen(url).read()
        if source:

            topo, rodape = source.split("morris-cut")
            portal._addHtml(path=path,
                            filename="topo.html",
                            source=topo)
            portal._addHtml(path=path,
                            filename="rodape.html",
                            source=rodape)

            return "Includes criados"

        return "Ocorreu um problema ao gerar os includes"
开发者ID:intip,项目名称:da-apps,代码行数:31,代码来源:app.py


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