[Zope] Creating a List from a SQLMethod
Jim Sanford
jsanford@atinucleus.com
Tue, 4 Jan 2000 06:53:23 -0600
If you have cacheing turned on for the query (cache persistence time > time for zope to render page), zope should pull the select
items from the cache and not actually rerun the query on the database server. Therefore, the time saved by creating a list to reuse
is probably negligible.
Also, the way you are doing it results in the list of select items being sent in html multiple times, if the select is a long one
this will noticebly slow down the loading speed on the browser for those with slow connections. An alternative would be to create a
javascript array once and use a javascript function to create the select lists on the browser to your hearts content.
__________________________________________________________________
Jim Sanford
. Database/Web Engineer
/ \ / Accelerated Technology, Inc.
/ / 720 Oak Circle Drive East
/ / \ Mobile, AL 36609
/ / \ Voice: 334-661-5770 fax: 334-661-5788
/ \ E-Mail: jsanford@atinucleus.com
Web: http://www.atinucleus.com
Source Code, No Royalties, Any CPU...It just make sense !
__________________________________________________________________
----- Original Message -----
From: Phil Harris <phil.harris@zope.co.uk>
To: Timothy Grant <tjg@avalongroup.net>; Zope Folk <zope@zope.org>
Sent: Monday, January 03, 2000 5:10 PM
Subject: Re: [Zope] Creating a List from a SQLMethod
How about something like (untested)
<select name="Category">
<option>(None)>
<dtml-call "REQUEST.set('catlist',[])">
<dtml-in CategorySelectQuery start=query_start>
<option><dtml-var category>
<dtml-call "catlist.append(category))">
</dtml-in>
</select>
Phil
phil.harris@zope.co.uk
----- Original Message -----
From: "Timothy Grant" <tjg@avalongroup.net>
To: "Zope Folk" <zope@zope.org>
Sent: Monday, January 03, 2000 12:34 PM
Subject: [Zope] Creating a List from a SQLMethod
> Hi,
>
> I've got a page that displays a <select> list based on the return values
> from a SQLMethod. It works exactly as expected.
>
> I have now determined a need to display the exact same <select> multiple
> times on the same page.
>
> The original code to build the select list looks something like this:
>
> <select name="Category">
> <option>(None)
> <dtml-in CategorySelectQuery start=query_start>
> <option><dtml-var category>
> </dtml-in>
> </select>
>
> I thought I could do something like the following:
> <select name="Category">
> <option>(None)
> <dtml-in CategorySelectQuery start=query_start>
> <option><dtml-var category>
> <dtml-call "REQUEST.set('catlist:list', category)">
> </dtml-in>
> </select>
>
> And then later on the page do this
>
> <select name="category">
> <dtml-in catlist>
> <option><dtml-var "_['sequence-item']">
> </dtml-in>
> </select>
>
> Unfortunately Zope returns a Key error on catlist.
>
> What am I doing wrong?
>
> Thanks.
>
>
>
> --
> Stand Fast,
> tjg.
>
> Chief Technology Officer tjg@exceptionalminds.com
> Red Hat Certified Engineer www.exceptionalminds.com
> Avalon Technology Group, Inc. (503) 246-3630
> >>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
_______________________________________________
Zope maillist - Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )