[Zope] Dynamic Reference, mixing ZOPE and SQL

Dieter Maurer dieter at handshake.de
Wed Feb 4 15:56:19 EST 2004


Ryan T. Bard wrote at 2004-1-30 13:17 -0500:
>I have a sequence of code that is monstrously inefficient and am
>looking for help. I am storing the id tag of an ExtFile object in my
>sql database along with other information and am now creating a page
>that displays info from the database record by record. For each
>record displayed, I also want to pull the file size from the Zope
>side of things.
>
>The method which works is something like this:
>
>    <dtml-in my_query>
>      <dtml-comment>
>        query returns file_id amongst other values
>      </dtml-comment>

>      <dtml-with files>
>        <dtml-in "objectValues(['ExtFile'])">
>          <dtml-if "id == file_id">
>            <dtml-var size>
>          </dtml-if>
>        </dtml-in>
>      </dtml-with>

Replace this with

	<dtml-with expr="_.getattr(files,file_id)">
	  <dtml-var size>
	</dtml-with>

-- 
Dieter



More information about the Zope mailing list