[zope-pt] Re: Como capturar informações de uma notícia
Pessoal, estou tentando fazer o mesmo que o Julio, e tenho tido sucesso. Mas estou tendo um problema, que até parece simples. Antes, estou pegando três grupos de notícias, cada uma com sua notícia respectiva, e elas seguem dessa forma: Nome da Pasta Título Descrição leia mais... Um probleminha, é que eu não quero que na página, o Nome da Pasta, não tenha nenhum link, eu gostaria de, somente o Título tenha o link referenta para a notícia, e o Leia mais... tenha o link para o Nome da Pasta... --- Em zope-pt@yahoogrupos.com.br, Julio Zinga Suzuki Lopes juliozi...@... escreveu Ok amigos, Obrigado pela ajuda. Vejam como ficou a minha solução: Defini o que obj_url dd tal:define=obj_url obj/getURL|obj/absolute_url; oddrow repeat/obj/odd tal:attributes=class python:test('portletItem') E depois fim obj_url+'/image_thumb' img src=# alt= tal:attributes=src python:test (obj_url+'/image_thumb') / Saudações. 2009/1/7 Alexandre Marinho lyrale...@... Com certeza essa é uma melhor opção! Ia ate mencionar isso, mas terminei esquecendo. -- Alexandre Marinho http://alexandre.cuboestudioweb.com 2009/1/6 rafael rafaelcro...@... Ola, Basta vc pegar a url da noticia e colocar a url da imagem como url/image ... Pelo menos faço assim aqui... []s Alexandre Marinho escreveu: Esse erro deve estar acontecendo porque voçe estra obtendo os objetos atravez do catalog, ao fazer isso as somente os atributos sao indexados por isso você nao consegue utilizar a funcao tag de newsitem. Uma solução rápida seria faser: img tal:replace=structure python: obj.getObject().tag (scale='mini', css_class='newsImage') src= alt= / Isso deve funcionar, porém cuidado com o getObject... ele retorna todo o objeto pra você e isso pode levar a problemas de performace no futuro. -- Alexandre Marinho http://alexandre.cuboestudioweb.com http://alexandre.cuboestudioweb.com 2009/1/6 Julio Zinga Suzuki Lopes juliozi...@... mailto:juliozi...@... Hoje tentei capturar a foto, com um comando python[1], mas não deu certo. Estou utilizando ele dentro de um portlet, chamado portlet_destaque (como os portlets do exemplo [2] citado anteriormente). E o arquivo index_html o invoca. Aqui está o código do portlet [3], o código do index_html[4] e o erro gerado [5]. O que quero é a foto na página principal, apenas. [1] - img tal:replace=structure python: obj.tag (scale='mini', css_class='newsImage') src= alt= / [2] - http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a- sua-pagina-de-apresentacao http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a- sua-pagina-de-apresentacao [3] - html head title tal:content=template/titleThe title/title meta http-equiv=content-type content=text/html;charset=utf-8 /head body !--div metal:define-macro=portlet h2Documento Destaque/h2 -- div metal:define-macro=portlet tal:define=results python:here.portal_catalog.searchResults(portal_type='News Item', sort_on = 'Date', sort_order='reverse', review_state='published')[:1]; dl id=portlet-noticias dt class=portletHeader spanaDestaque/a/span /dt tal:links tal:repeat=obj results dd tal:define=oddrow repeat/obj/odd tal:attributes=class python:test ('portletItem') a href= class=tile tal:attributes=href obj/getURL; title obj/Description tal:block replace=structure here/document_icon.gif/ span tal:replace=obj/pretty_title_or_id titulo_ou_id /span - span tal:replace=obj/Description titulo_ou_id /span span tal:replace=obj/Description description /span img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / /a /dd /tal:links dd class=portletFooter a href=/newsVer todos as notícias.../a /dd /dl /div /body /html [4] html metal:use-macro=here/main_template/macros/master div metal:fill-slot=content style=padding:1em; div metal:use-macro=here/portlet_destaque/macros/portlet portlet inicial - destaque /div
Re: [zope-pt] Re: Como capturar informações de uma notícia
Ola, Basta vc pegar a url da noticia e colocar a url da imagem como url/image ... Pelo menos faço assim aqui... []s Alexandre Marinho escreveu: Esse erro deve estar acontecendo porque voçe estra obtendo os objetos atravez do catalog, ao fazer isso as somente os atributos sao indexados por isso você nao consegue utilizar a funcao tag de newsitem. Uma solução rápida seria faser: img tal:replace=structure python: obj.getObject().tag(scale='mini', css_class='newsImage') src= alt= / Isso deve funcionar, porém cuidado com o getObject... ele retorna todo o objeto pra você e isso pode levar a problemas de performace no futuro. -- Alexandre Marinho http://alexandre.cuboestudioweb.com http://alexandre.cuboestudioweb.com 2009/1/6 Julio Zinga Suzuki Lopes juliozi...@gmail.com mailto:juliozi...@gmail.com Hoje tentei capturar a foto, com um comando python[1], mas não deu certo. Estou utilizando ele dentro de um portlet, chamado portlet_destaque (como os portlets do exemplo [2] citado anteriormente). E o arquivo index_html o invoca. Aqui está o código do portlet [3], o código do index_html[4] e o erro gerado [5]. O que quero é a foto na página principal, apenas. [1] - img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / [2] - http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao [3] - html head title tal:content=template/titleThe title/title meta http-equiv=content-type content=text/html;charset=utf-8 /head body !--div metal:define-macro=portlet h2Documento Destaque/h2 -- div metal:define-macro=portlet tal:define=results python:here.portal_catalog.searchResults(portal_type='News Item', sort_on = 'Date', sort_order='reverse', review_state='published')[:1]; dl id=portlet-noticias dt class=portletHeader spanaDestaque/a/span /dt tal:links tal:repeat=obj results dd tal:define=oddrow repeat/obj/odd tal:attributes=class python:test('portletItem') a href= class=tile tal:attributes=href obj/getURL; title obj/Description tal:block replace=structure here/document_icon.gif/ span tal:replace=obj/pretty_title_or_id titulo_ou_id /span - span tal:replace=obj/Description titulo_ou_id /span span tal:replace=obj/Description description /span img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / /a /dd /tal:links dd class=portletFooter a href=/newsVer todos as notícias.../a /dd /dl /div /body /html [4] html metal:use-macro=here/main_template/macros/master div metal:fill-slot=content style=padding:1em; div metal:use-macro=here/portlet_destaque/macros/portlet portlet inicial - destaque /div div metal:use-macro=here/portlet_noticias/macros/portlet portlet inicial - noticias /div /div /html [5] Exception traceback Time 2009/01/06 11:17:56.342 GMT-3 User Name (User Id) admin (admin) Request URL http://localhost:8080/portal/index_html http://localhost:8080/portal/index_html Exception TypeAttributeError Exception Value tag Traceback (innermost last): * Module ZPublisher.Publish, line 119, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 42, in call_object * Module Shared.DC.Scripts.Bindings, line 313, in __call__ * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec * Module Products.PageTemplates.ZopePageTemplate, line 330, in _exec * Module Products.PageTemplates.ZopePageTemplate, line 427, in pt_render * Module Products.PageTemplates.PageTemplate, line 89, in pt_render * Module zope.pagetemplate.pagetemplate, line 117, in pt_render * Module zope.tal.talinterpreter, line 271, in __call__ * Module
Re: [zope-pt] Re: Como capturar informações de uma notícia
Com certeza essa é uma melhor opção! Ia ate mencionar isso, mas terminei esquecendo. -- Alexandre Marinho http://alexandre.cuboestudioweb.com 2009/1/6 rafael rafaelcro...@gmail.com Ola, Basta vc pegar a url da noticia e colocar a url da imagem como url/image ... Pelo menos faço assim aqui... []s Alexandre Marinho escreveu: Esse erro deve estar acontecendo porque voçe estra obtendo os objetos atravez do catalog, ao fazer isso as somente os atributos sao indexados por isso você nao consegue utilizar a funcao tag de newsitem. Uma solução rápida seria faser: img tal:replace=structure python: obj.getObject().tag(scale='mini', css_class='newsImage') src= alt= / Isso deve funcionar, porém cuidado com o getObject... ele retorna todo o objeto pra você e isso pode levar a problemas de performace no futuro. -- Alexandre Marinho http://alexandre.cuboestudioweb.com http://alexandre.cuboestudioweb.com 2009/1/6 Julio Zinga Suzuki Lopes juliozi...@gmail.com mailto:juliozi...@gmail.com Hoje tentei capturar a foto, com um comando python[1], mas não deu certo. Estou utilizando ele dentro de um portlet, chamado portlet_destaque (como os portlets do exemplo [2] citado anteriormente). E o arquivo index_html o invoca. Aqui está o código do portlet [3], o código do index_html[4] e o erro gerado [5]. O que quero é a foto na página principal, apenas. [1] - img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / [2] - http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao [3] - html head title tal:content=template/titleThe title/title meta http-equiv=content-type content=text/html;charset=utf-8 /head body !--div metal:define-macro=portlet h2Documento Destaque/h2 -- div metal:define-macro=portlet tal:define=results python:here.portal_catalog.searchResults(portal_type='News Item', sort_on = 'Date', sort_order='reverse', review_state='published')[:1]; dl id=portlet-noticias dt class=portletHeader spanaDestaque/a/span /dt tal:links tal:repeat=obj results dd tal:define=oddrow repeat/obj/odd tal:attributes=class python:test('portletItem') a href= class=tile tal:attributes=href obj/getURL; title obj/Description tal:block replace=structure here/document_icon.gif/ span tal:replace=obj/pretty_title_or_id titulo_ou_id /span - span tal:replace=obj/Description titulo_ou_id /span span tal:replace=obj/Description description /span img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / /a /dd /tal:links dd class=portletFooter a href=/newsVer todos as notícias.../a /dd /dl /div /body /html [4] html metal:use-macro=here/main_template/macros/master div metal:fill-slot=content style=padding:1em; div metal:use-macro=here/portlet_destaque/macros/portlet portlet inicial - destaque /div div metal:use-macro=here/portlet_noticias/macros/portlet portlet inicial - noticias /div /div /html [5] Exception traceback Time 2009/01/06 11:17:56.342 GMT-3 User Name (User Id) admin (admin) Request URL http://localhost:8080/portal/index_html http://localhost:8080/portal/index_html Exception TypeAttributeError Exception Value tag Traceback (innermost last): * Module ZPublisher.Publish, line 119, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 42, in call_object * Module Shared.DC.Scripts.Bindings, line 313, in __call__ * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec * Module Products.PageTemplates.ZopePageTemplate, line 330, in _exec * Module Products.PageTemplates.ZopePageTemplate, line 427, in pt_render * Module Products.PageTemplates.PageTemplate, line 89, in pt_render * Module
Re: [zope-pt] Re: Como capturar informações de uma notícia
Ok amigos, Obrigado pela ajuda. Vejam como ficou a minha solução: Defini o que obj_url dd tal:define=obj_url obj/getURL|obj/absolute_url; oddrow repeat/obj/odd tal:attributes=class python:test('portletItem') E depois fim obj_url+'/image_thumb' img src=# alt= tal:attributes=src python:test(obj_url+'/image_thumb') / Saudações. 2009/1/7 Alexandre Marinho lyrale...@gmail.com Com certeza essa é uma melhor opção! Ia ate mencionar isso, mas terminei esquecendo. -- Alexandre Marinho http://alexandre.cuboestudioweb.com 2009/1/6 rafael rafaelcro...@gmail.com Ola, Basta vc pegar a url da noticia e colocar a url da imagem como url/image ... Pelo menos faço assim aqui... []s Alexandre Marinho escreveu: Esse erro deve estar acontecendo porque voçe estra obtendo os objetos atravez do catalog, ao fazer isso as somente os atributos sao indexados por isso você nao consegue utilizar a funcao tag de newsitem. Uma solução rápida seria faser: img tal:replace=structure python: obj.getObject().tag(scale='mini', css_class='newsImage') src= alt= / Isso deve funcionar, porém cuidado com o getObject... ele retorna todo o objeto pra você e isso pode levar a problemas de performace no futuro. -- Alexandre Marinho http://alexandre.cuboestudioweb.com http://alexandre.cuboestudioweb.com 2009/1/6 Julio Zinga Suzuki Lopes juliozi...@gmail.com mailto:juliozi...@gmail.com Hoje tentei capturar a foto, com um comando python[1], mas não deu certo. Estou utilizando ele dentro de um portlet, chamado portlet_destaque (como os portlets do exemplo [2] citado anteriormente). E o arquivo index_html o invoca. Aqui está o código do portlet [3], o código do index_html[4] e o erro gerado [5]. O que quero é a foto na página principal, apenas. [1] - img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / [2] - http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao [3] - html head title tal:content=template/titleThe title/title meta http-equiv=content-type content=text/html;charset=utf-8 /head body !--div metal:define-macro=portlet h2Documento Destaque/h2 -- div metal:define-macro=portlet tal:define=results python:here.portal_catalog.searchResults(portal_type='News Item', sort_on = 'Date', sort_order='reverse', review_state='published')[:1]; dl id=portlet-noticias dt class=portletHeader spanaDestaque/a/span /dt tal:links tal:repeat=obj results dd tal:define=oddrow repeat/obj/odd tal:attributes=class python:test('portletItem') a href= class=tile tal:attributes=href obj/getURL; title obj/Description tal:block replace=structure here/document_icon.gif/ span tal:replace=obj/pretty_title_or_id titulo_ou_id /span - span tal:replace=obj/Description titulo_ou_id /span span tal:replace=obj/Description description /span img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / /a /dd /tal:links dd class=portletFooter a href=/newsVer todos as notícias.../a /dd /dl /div /body /html [4] html metal:use-macro=here/main_template/macros/master div metal:fill-slot=content style=padding:1em; div metal:use-macro=here/portlet_destaque/macros/portlet portlet inicial - destaque /div div metal:use-macro=here/portlet_noticias/macros/portlet portlet inicial - noticias /div /div /html [5] Exception traceback Time 2009/01/06 11:17:56.342 GMT-3 User Name (User Id) admin (admin) Request URL http://localhost:8080/portal/index_html http://localhost:8080/portal/index_html Exception TypeAttributeError Exception Value tag Traceback (innermost last): * Module ZPublisher.Publish, line 119, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 42, in call_object * Module
Re: [zope-pt] Re: Como capturar informações de uma notícia
Esse erro deve estar acontecendo porque voçe estra obtendo os objetos atravez do catalog, ao fazer isso as somente os atributos sao indexados por isso você nao consegue utilizar a funcao tag de newsitem. Uma solução rápida seria faser: img tal:replace=structure python: obj.getObject().tag(scale='mini', css_class='newsImage') src= alt= / Isso deve funcionar, porém cuidado com o getObject... ele retorna todo o objeto pra você e isso pode levar a problemas de performace no futuro. -- Alexandre Marinho http://alexandre.cuboestudioweb.com 2009/1/6 Julio Zinga Suzuki Lopes juliozi...@gmail.com Hoje tentei capturar a foto, com um comando python[1], mas não deu certo. Estou utilizando ele dentro de um portlet, chamado portlet_destaque (como os portlets do exemplo [2] citado anteriormente). E o arquivo index_html o invoca. Aqui está o código do portlet [3], o código do index_html[4] e o erro gerado [5]. O que quero é a foto na página principal, apenas. [1] - img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / [2] - http://www.leonardomiranda.com.br/Members/admin_leo/artigos/criando-a-sua-pagina-de-apresentacao [3] - html head title tal:content=template/titleThe title/title meta http-equiv=content-type content=text/html;charset=utf-8 /head body !--div metal:define-macro=portlet h2Documento Destaque/h2 -- div metal:define-macro=portlet tal:define=results python:here.portal_catalog.searchResults(portal_type='News Item', sort_on = 'Date', sort_order='reverse', review_state='published')[:1]; dl id=portlet-noticias dt class=portletHeader spanaDestaque/a/span /dt tal:links tal:repeat=obj results dd tal:define=oddrow repeat/obj/odd tal:attributes=class python:test('portletItem') a href= class=tile tal:attributes=href obj/getURL; title obj/Description tal:block replace=structure here/document_icon.gif/ span tal:replace=obj/pretty_title_or_id titulo_ou_id /span - span tal:replace=obj/Description titulo_ou_id /span span tal:replace=obj/Description description /span img tal:replace=structure python: obj.tag(scale='mini', css_class='newsImage') src= alt= / /a /dd /tal:links dd class=portletFooter a href=/newsVer todos as notícias.../a /dd /dl /div /body /html [4] html metal:use-macro=here/main_template/macros/master div metal:fill-slot=content style=padding:1em; div metal:use-macro=here/portlet_destaque/macros/portlet portlet inicial - destaque /div div metal:use-macro=here/portlet_noticias/macros/portlet portlet inicial - noticias /div /div /html [5] Exception traceback Time 2009/01/06 11:17:56.342 GMT-3 User Name (User Id) admin (admin) Request URL http://localhost:8080/portal/index_html Exception Type AttributeError Exception Value tag Traceback (innermost last): - Module ZPublisher.Publish, line 119, in publish - Module ZPublisher.mapply, line 88, in mapply - Module ZPublisher.Publish, line 42, in call_object - Module Shared.DC.Scripts.Bindings, line 313, in __call__ - Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec - Module Products.PageTemplates.ZopePageTemplate, line 330, in _exec - Module Products.PageTemplates.ZopePageTemplate, line 427, in pt_render - Module Products.PageTemplates.PageTemplate, line 89, in pt_render - Module zope.pagetemplate.pagetemplate, line 117, in pt_render - Module zope.tal.talinterpreter, line 271, in __call__ - Module zope.tal.talinterpreter, line 346, in interpret - Module zope.tal.talinterpreter, line 891, in do_useMacro - Module zope.tal.talinterpreter, line 346, in interpret - Module zope.tal.talinterpreter, line 536, in do_optTag_tal - Module zope.tal.talinterpreter, line 521, in do_optTag - Module zope.tal.talinterpreter, line 516, in no_tag - Module zope.tal.talinterpreter, line 346, in interpret - Module zope.tal.talinterpreter, line 949, in do_defineSlot - Module zope.tal.talinterpreter, line 346, in interpret - Module zope.tal.talinterpreter, line 891, in do_useMacro - Module zope.tal.talinterpreter, line 346, in interpret - Module zope.tal.talinterpreter, line 824, in do_loop_tal - Module zope.tal.talinterpreter, line 346, in interpret - Module zope.tal.talinterpreter, line 536, in do_optTag_tal - Module zope.tal.talinterpreter, line 521, in do_optTag - Module zope.tal.talinterpreter, line 516, in