'str' object is not callable ERROR

2 Messages Forum Options Options
Embed this topic
Permalink
Raul Buira
'str' object is not callable ERROR
Reply Threaded MoreMore options
Print post
Permalink

Hi!

I have a Page Template that is built with the information of 3 objects that I search in the catalogue with the following expression:


     <div tal:define="results python:request.get('news', here.portal_catalog.searchResults( portal_type='noticia_portada', sort_on='getPosicio'
                                                                                     , path='prototipo/gestion_portadas_intranet/portada_principal/'
                                                                                     , review_state_operator='or'
                                                                                     , review_state=('private','publicado','visible'))[:3]);">

<div tal:define="res0 python:results[0]">


When I have these objectes I ask for their Title, Description and Foto fields like this:

<span tal:replace="res0/getTitulo">
<span tal:replace="res0/getDescripcio">
<span tal:replace="structure res0/getImatge"/>


All is ok with the Title and Description, but when I ask for the Foto (which is an ImageField) I find this error:

 
Tipo de Error
TypeError
Valor del Error
'str' object is not callable




do you know why?

Thanks!
Carlo Capuano
RE: 'str' object is not callable ERROR
Reply Threaded MoreMore options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Hi,

 

If res0/getImatge return an Image you have to put it as image tag giving the method url as src

 

<img src=”#” tal:attributes=”src python:res0.absolute_url()+’/getImage’ ”>

 

If you got a broken image in the page check the error log for more details

 

Carlo.

 

 

<span tal:replace="res0/getTitulo">
<span tal:replace="res0/getDescripcio">
<span tal:replace="structure res0/getImatge"/>

 



All is ok with the Title and Description, but when I ask for the Foto (which is an ImageField) I find this error:

 

Tipo de Error
TypeError
Valor del Error
'str' object is not callable





do you know why?

Thanks!