def _getUltimasNoticiasComentadas(self, hash, limit=20, offset=0, d1=None, d2=None, qw=None, exportar=1, render=None): """ """ if type(hash) is not list: hash = [hash] portal = Portal(id_site=self.id_site, request=self.request) site = getDadosSite(id_site=self.id_site, request=self.request) base = site["base_html"] items = portal._listarConteudoApp(id_site=self.id_site, hash=hash, comentario=1, acesso=None, acesso24h=None, voto=None, keywords=qw, de=d1, ate=d2, limit=limit, offset=offset, rendeer=render) itens = [] idcs = [] idcsd = {} items_ = [i for i in items["itens"] if idcs.append(str(i["id_conteudo"])) or 1] if idcs: for i in self.execSql("select_svgs", id_conteudos=buffer(",".join(idcs))): idcsd[i["id_conteudo"]] = i for i in items_: if idcsd.get(i["id_conteudo"]): i["audio"] = idcsd.get(i["id_conteudo"])["audio"] i["video"] = idcsd.get(i["id_conteudo"])["video"] i["galeria"] = idcsd.get(i["id_conteudo"])["galeria"] else: i["audio"] = None i["video"] = None i["galeria"] = None itens.append(i) return {"res":itens, "qtde":items["qtde"]}
def _getNoticiaPublicadaUltima(self, id_noticia=None, hash=None, mkl=None): """ Retorna os dados de uma noticia ou a ultima do hash """ if id_noticia: return self._getNoticiaPublicada(id_noticia=id_noticia, mkl=mkl) elif hash: portal = Portal(id_site=self.id_site, request=self.request) for i in portal._listarConteudoApp(id_site=self.id_site, hash=[hash], comentario=False, acesso=False, acesso24h=None, voto=False, limit=1)["itens"]: return self._getNoticiaPublicada(id_noticia=i["id_conteudo"], mkl=mkl)
def _getUltimasNoticias(self, hash, limit=20, offset=0, d1=None, d2=None, qw=None, exportar=None, render=None, tags=[], corpo=None): """ """ if type(hash) is not list: hash = [hash] portal = Portal(id_site=self.id_site, request=self.request) site = getDadosSite(id_site=self.id_site, request=self.request) base = site["base_html"] base_img = site["base_img"] items = portal._listarConteudoApp(id_site=self.id_site, hash=hash, comentario=False, acesso=False, acesso24h=None, voto=False, keywords=qw, de=d1, ate=d2, tags=tags, limit=limit, offset=offset, render=render) itens = [] idcs = [] idcsd = {} items_ = [i for i in items["itens"] if idcs.append(str(i["id_conteudo"])) or 1] if idcs: for i in self.execSql("select_svgs", id_conteudos=buffer(",".join(idcs))): idcsd[i["id_conteudo"]] = i for i in items_: if idcsd.get(i["id_conteudo"]): i["audio"] = idcsd.get(i["id_conteudo"])["audio"] i["video"] = idcsd.get(i["id_conteudo"])["video"] i["galeria"] = idcsd.get(i["id_conteudo"])["galeria"] else: i["audio"] = None i["video"] = None i["galeria"] = None if corpo: res = i["serialized"]() if res: corpo = self._formatarCorpo(corpo=res["dados"]["corpo"], fotos=res["dados"]["foto"], editor=res["dados"]["editor"], base_img=base_img) i["corpo"] = corpo i["titulo_categoria"] = res["dados"]["titulo_categoria"] i["autor_nome"] = None i["autor_email"] = None i["autor_grupo"] = None if res["dados"]["autor"]: for x in self.execSql("select_autor_noticia", id_conteudo=i["id_conteudo"]): i["autor_nome"] = x["nome"] i["autor_email"] = x["email"] i["autor_grupo"] = x["grupo"] break i["serialized"] = res itens.append(i) return {"res":itens, "qtde":items["qtde"]}