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


Python Portal.mklink方法代码示例

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


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

示例1: _setDados

# 需要导入模块: from publica.core.portal import Portal [as 别名]
# 或者: from publica.core.portal.Portal import mklink [as 别名]
    def _setDados(self, id_conteudo):
        """
        """
        for conteudo in self.execSql("select_conteudo_",
                                     id_conteudo=int(id_conteudo)):

            portal = Portal(id_site=self.id_site,
                            request=self.request)
            tags = []
            url = portal.getUrlByApp(env_site=self.id_site,
                                     schema=self.schema,
                                     id_conteudo=id_conteudo,
                                     exportar=1,
                                     admin=1,
                                     mkattr=1)

            dados = {"titulo":conteudo["titulo"],
                     "descricao":conteudo["descricao"],
                     "imagem_destaque":conteudo["imagem_destaque"],
                     "titulo_destaque":conteudo["titulo_destaque"],
                     "descricao_destaque":conteudo["descricao_destaque"],
                     "link_destaque":portal.mklink(conteudo["link_destaque"]),
                     "capa":[],
                     "destaque":[{"titulo":conteudo["destaque_titulo"],
                                  "descricao":conteudo["destaque_descricao"],
                                  "img":conteudo["destaque_imagem"]}],
                     "tags":tags}


            for i in self.execSql("select_destaque1",
                                  id_conteudo=int(id_conteudo)):

                dados["capa"].append({"titulo":i["titulo"],
                                           "imagem":i["imagem"],
                                           "descricao":i["descricao"],
                                           "link":portal.mklink(i["link"]),
                                           "ordem":i["ordem"]})

            return {"titulo":conteudo["titulo"],
                    "meta_type":self.meta_type,
                    "id_conteudo":id_conteudo,
                    "publicado_em":conteudo["publicado_em"],
                    "expira_em":conteudo["expira_em"],
                    "atualizado_em":conteudo["atualizado_em"],
                    "url":url,
                    "creators":[],
                    "dados":dados}
开发者ID:intip,项目名称:da-apps,代码行数:49,代码来源:app.py

示例2: _getProgramacao

# 需要导入模块: from publica.core.portal import Portal [as 别名]
# 或者: from publica.core.portal.Portal import mklink [as 别名]
    def _getProgramacao(self, id_conteudo=None):
        """
          return the data of conteudo, destaque1, destaque2 and destaque tables
        """
        portal = Portal(id_site=self.id_site,
                        request=self.request)

        if id_conteudo:
            items = self.execSql("select_conteudo",
                              id_conteudo=int(id_conteudo))
        else:
            items = self.execSql("select_conteudo2")

        for i in items:
            id_conteudo = i["id_conteudo"]
            i["link_destaque"] = portal.mklink(dados=i["link_destaque"])

            i["destaque1"] = []
            for item in self.execSql("select_destaque1",
                                     id_conteudo=int(id_conteudo)):
                item["link"] = portal.mklink(dados=item["link"])
                i["destaque1"].append(item)

            return i
开发者ID:intip,项目名称:da-apps,代码行数:26,代码来源:site.py

示例3: _getNoticiaPublicada

# 需要导入模块: from publica.core.portal import Portal [as 别名]
# 或者: from publica.core.portal.Portal import mklink [as 别名]
    def _getNoticiaPublicada(self, id_noticia=None, mkl=None):
        """ Retorna os dados de uma noticia
        """
        noticia = None
        portal = Portal(id_site=self.id_site,
                        request=self.request)

        if not noticia:
            for noticia in self.execSql("select_noticia_publicada_ultima"):
                break

        for noticia in self.execSql("select_noticia_publicada",
                                    id_conteudo=int(id_noticia)):
            break

        if noticia:
            soup = BeautifulSoup(noticia["corpo"],
                                 fromEncoding=settings.GLOBAL_ENCODING)
            for a in soup.findAll("a"):
                href = unquote(a.get("href", "")).strip()
                if href.startswith("#h2href:"):
                    kingkong, dados = href.split("#h2href:", 1)
                    if mkl:
                        href, attrs = mkl(dados=decode(dados))
                        for i in attrs.keys():
                            a[i] = attrs[i]
                    else:
                        href = portal.mklink(dados=dados)

                    if href.find("javascript") >= 0:
                        href = href.replace("[target=blank]", "")
                    elif href.find("target=blank") >= 0:
                        href = href.replace("[target=blank]", "")
                        a["target"] = "blank"

                    a["href"] = href

            noticia["corpo"] = unquote( unicode(soup) )

        return noticia
开发者ID:intip,项目名称:da-apps,代码行数:42,代码来源:public.py

示例4: mkson

# 需要导入模块: from publica.core.portal import Portal [as 别名]
# 或者: from publica.core.portal.Portal import mklink [as 别名]
    def mkson(self, item, builder, tag='li', ignore=False,
                    exportar=None, uln=[], lin=[], la=[], nivelu=0, nivell=0):
        """
        """
        portal = Portal(id_site=self.id_site,
                        request=self.request)
        link = item['attributes'].get('jtext', None)
        classe = item['attributes'].get('classe', None)
        semTexto = item['attributes'].get('semTexto', None)
        scriptBanner = item['attributes'].get('scriptBanner', None)

        if not ignore:

            try:
                attr = lin[nivell]
            except:
                attr = {}

            try:
                attra = la[nivell]
            except:
                attra = {}

            if classe:
                attr['class'] = classe
            builder.start(tag, attr)

            if link:
                attra['href'] = portal.mklink(dados=link, exportar=exportar)
                if attra["href"].find("[target=blank]") >= 0:
                    attra["href"] = attra["href"].replace("[target=blank]", "")
                    if attra['href'].find('window.open') < 0:
                        attra["target"] = "blank"
                builder.start('a', attra)

	    if scriptBanner:
                builder.start('script',{})
                builder.data(scriptBanner)

            if not(semTexto == 'true'):
                builder.data(item['data'])

        if not ignore:
            if link:
                builder.end('a')
	    if scriptBanner:
                builder.end('script')

        nivelu+=1
        itens = item.get('children', [])
        nitens = len(itens)
        for i in xrange(nitens):
            if i == 0:
                ignf = False
                ignl = True
            elif i == (nitens-1):
                ignf = True
                ignl = False
            else:
                ignf = True
                ignl = True

            if nitens == 1:
                ignl = False

            if (i + 1) < nitens:
                proximoitem=itens[i+1]
            else:
                proximoitem=None

            self.mkfather(itens[i], builder=builder, ignf=ignf, ignl=ignl, uln=uln,
                          lin=lin, la=la, nivelu=nivelu, nivell=nivell+1, proximoitem=proximoitem)

        if not ignore:
            builder.end(tag)
开发者ID:intip,项目名称:da-apps,代码行数:77,代码来源:site.py


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