[Zope-DB] ZPT and ZSQL Method calling

Andreas Jung lists at zopyx.com
Thu Jun 24 01:18:04 EDT 2004


You are mixing Python notations and path expressions in nearly very 
possible combination.

Why don't you use a Python *only* syntax like:

python: here.getOffered_detail(some_arg=here.feature_title_id)

I recommended having a look at the Zope Book 2.7 (!) edition RDBMS 
chapter...the examples
should be clear and straight forward (and of course a look at the ZPT 
reference).

-aj

--On Montag, 21. Juni 2004 11:53 Uhr +0100 Ian Steel <ian at bilstone.co.uk> 
wrote:

> 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.
>
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db



Andreas Jung
zopyx.com - Software Development and Consulting Andreas Jung


More information about the Zope-DB mailing list