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/title">The title</title> > <meta http-equiv="content-type" content="text/html;charset=utf-8"> > </head> > <body> > <!-- <div metal:define-macro="portlet"> > <h2>Documento 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"> > <span><a>Destaque</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="/news">Ver 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 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 no_tag > * Module zope.tal.talinterpreter, line 346, in interpret > * Module zope.tal.talinterpreter, line 534, in do_optTag_tal > * Module zope.tal.talinterpreter, line 516, in no_tag > * Module zope.tal.talinterpreter, line 346, in interpret > * Module zope.tal.talinterpreter, line 745, in > do_insertStructure_tal > * Module Products.PageTemplates.Expressions, line 221, in > evaluateStructure > * Module zope.tales.tales, line 696, in evaluate > *URL: /portal/portal_skins/custom/portlet_destaque* > *Line 41, Column 0* > *Expression: <PythonExpr obj.tag(scale='mini', > css_class='newsImage')>* > *Names:* > > {'container': <PloneSite at /portal>, > 'context': <PloneSite at /portal>, > 'default': <object object at 0xb7ccb528>, > 'here': <PloneSite at /portal>, > > > 'loop': {u'obj': <Products.PageTemplates.Expressions.PathIterator > object at 0xe08284c>}, > 'nothing': None, > 'options': {'args': ()}, > 'repeat': <Products.PageTemplates.Expressions.SafeMapping object > at 0xde9f0ac>, > > > 'request': <HTTPRequest, > URL=http://localhost:8080/portal/index_html > <http://localhost:8080/portal/index_html>>, > 'root': <Application at >, > 'template': <ZopePageTemplate at /portal/index_html>, > > > 'traverse_subpath': [], > 'user': <PropertiedUser 'admin'>} > > * Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__ > __traceback_info__: obj.tag(scale='mini', css_class='newsImage') > * Module PythonExpr, line 1, in <expression> > > AttributeError: tag > > Display traceback as text > > <http://localhost:8080/portal/error_log/getLogEntryAsText?id=1231251476.340.627887772275> > > > REQUEST > > > form > > -C '' > > > cookies > > tutorialExamplesURL 'http://localhost:8080/portal/teste/examples > <http://localhost:8080/portal/teste/examples>' > dtpref_rows '20' > __ac 'NjE2NDZkNjk2ZTo1OTU0MzU2YTUzNTE2YTRk' > dtpref_cols '95%' > tree-s 'eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuxEQ9AIOOB9Q' > > > lazy items > > SESSION <bound method SessionDataManager.getSessionData of > <SessionDataManager at /session_data_manager>> > > > other > > TraversalRequestNameStack [] > LANGUAGE 'en' > AUTHENTICATED_USER <PropertiedUser 'admin'> > URL 'http://localhost:8080/portal/index_html > <http://localhost:8080/portal/index_html>' > _pts_is_rtl False > SERVER_URL 'http://localhost:8080 <http://localhost:8080>' > LANGUAGE_TOOL > <Products.PloneLanguageTool.LanguageTool.LanguageBinding instance > at 0x96e1f6c> > AUTHENTICATION_PATH '' > traverse_subpath [] > _ec_cache {233553132: > <Products.PageTemplates.Expressions.ZopeContext object at 0xc45a0ec>} > __ac 'NjE2NDZkNjk2ZTo1OTU0MzU2YTUzNTE2YTRk' > PUBLISHED <ZopePageTemplate at /portal/index_html> > ACTUAL_URL 'http://localhost:8080/portal > <http://localhost:8080/portal>' > URL0 http://localhost:8080/portal/index_html > <http://localhost:8080/portal/index_html> > URL1 http://localhost:8080/portal <http://localhost:8080/portal> > URL2 http://localhost:8080 <http://localhost:8080> > BASE0 http://localhost:8080 <http://localhost:8080> > BASE1 http://localhost:8080 <http://localhost:8080> > BASE2 http://localhost:8080/portal <http://localhost:8080/portal> > BASE3 http://localhost:8080/portal/index_html > <http://localhost:8080/portal/index_html> > > > environ > > HTTP_COOKIE 'dtpref_rows="20"; dtpref_cols="95%"; > tutorialExamplesURL="http://localhost:8080/portal/teste/examples > <http://localhost:8080/portal/teste/examples>"; > tree-s="eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuxEQ9AIOOB9Q"; > __ac="NjE2NDZkNjk2ZTo1OTU0MzU2YTUzNTE2YTRk"' > SERVER_SOFTWARE 'Zope/(Zope 2.10.6-final, python 2.4.5, linux2) > ZServer/1.1 Plone/3.1.7' > SCRIPT_NAME '' > REQUEST_METHOD 'GET' > PATH_INFO '/portal' > SERVER_PROTOCOL 'HTTP/1.1' > channel.creation_time 1231249389 > CONNECTION_TYPE 'keep-alive' > HTTP_ACCEPT_CHARSET 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' > HTTP_USER_AGENT 'Mozilla/5.0 (X11; U; Linux i686; en-US; > rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4' > HTTP_REFERER > 'http://localhost:8080/portal/outras-noticias/noticia-3 > <http://localhost:8080/portal/outras-noticias/noticia-3>' > SERVER_NAME '0.0.0.0' > REMOTE_ADDR '127.0.0.1' > PATH_TRANSLATED '/portal' > SERVER_PORT '8080' > HTTP_HOST 'localhost:8080' > HTTP_CACHE_CONTROL 'max-age=0' > HTTP_ACCEPT > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' > GATEWAY_INTERFACE 'CGI/1.1' > HTTP_ACCEPT_LANGUAGE 'en-us,en;q=0.5' > HTTP_ACCEPT_ENCODING 'gzip,deflate' > HTTP_KEEP_ALIVE '300' > > > > 2009/1/5 Julio Zinga Suzuki Lopes <juliozi...@gmail.com > <mailto:juliozi...@gmail.com>> > > Boa tarde a todos da comunidade! > E um feliz ano a todos. > > A dúvida é a seguinte: > > Quero fazer a página inicial do meu portal, o conteúdo dela, > gostaria de capturar informações das 2 últimas notícias postadas. > Informações que quero: TITULO, FOTO, DESCRIÇÃO. > > Em um manual [1] da internet temos uma dicas que chegam muito > próximo do que é preciso. Porém falta a chamada da foto. > > > [1] > > 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> > -- > Júlio Zinga Suzuki Lopes > Analista de TI - CES-UFCG > Tel: (83) | (83) 3372-1926 | 9975-1646 > Cuité - PB/BR > juliozinga @ gmail.com <http://gmail.com> > jzinga @ ufcg.edu.br <http://ufcg.edu.br> > > > > > -- > Júlio Zinga Suzuki Lopes > Analista de TI - CES-UFCG > Tel: (83) | (83) 3372-1926 | 9975-1646 > Cuité - PB/BR > juliozinga @ gmail.com <http://gmail.com> > jzinga @ ufcg.edu.br <http://ufcg.edu.br> > > >