[Zope-DB] ZPT and ZSQL Method calling

Ian Steel ian at bilstone.co.uk
Mon Jun 21 06:53:36 EDT 2004


Hi,

Just started with Zope and it looks good.

I'm having a problem though and can't see the wood for the trees anymore.

Scenerio.

I'm creating a homepage for a website, which has an image on it. The image
is always named '/images/ioa_xxx' where xxx is an integer.
xxx is held as an attribute called feature_title_id of index_html (a page
template), and is changed by the site webmaster so that they can put a
different image on the homepage.
The details of the image (owner, caption, etc) are maintained in a mysql
database by another application - I need to access this info.
I've produced the zsql method (get_offered_detail) to get the info from
the mysql db passing it a parameter of 'id' - this works fine. I've also
produced the zpt to display the homepage - this works fine with a
hardcoded param of id in the call to the zsql.
However, I can't figure out how I should call the zsql method, passing as
the parameter the attribute of the index_html zpt as param 'id'.

I've tried this :

<div tal:define='xxx
nocall:here/get_offered_detail(o.id=here/feature_title_id)'>
Art: <span tal:replace="xxx/artist_name">tosh</span>
</div>

but no luck.

I've tried this :

<div tal:define='xxx nocall:here/feature_item_id/get_offered_detail'>
Art: <span tal:replace="xxx/artist_name">tosh</span>
</div>
but it complains that 'int doesn't have an attribute called
get_offered_detail'.

I've tried this :

<div tal:define='xxx nocall:here/get_offered_detail/feature_title_id'>
Art: <span tal:replace="xxx/artist_name">tosh</span>
</div>
I'm sure what I'm trying to attempt isn't beyond Zope, its just the way
I'm doing it.

which doesn't work, and yet this works:

<div tal:define='xxx nocall:here/get_offered_detail/85'>
Art: <span tal:replace="xxx/artist_name">tosh</span>
</div>
I'm sure what I'm trying to attempt isn't beyond Zope, its just the way
I'm doing it.

Could someone please point me in the right direction?

Thanks,

Ian.




More information about the Zope-DB mailing list