if you have 2 queries one of which returns tuples containing events and usernames, and the second returning a tuple with the user's URL, this should work: <dtml-in query_events_and_names> . . . <dtml-in "query_user_URL(username=username_from_query_events_and_name)"> <a href="<dtml-var user_URL>"><dtml-var username_from_query_events_and_name></a> </dtml-in> . . . </dtml-in> __________________________________________________________________ Jim Sanford . Database 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 Nucleus. All You NEED in an RTOS. Royalty Free __________________________________________________________________ ----- Original Message ----- From: ed colmar <element@immersivearts.com> To: <zope@zope.org> Sent: Friday, March 03, 2000 10:14 AM Subject: [Zope] Finding matches between two lists Hey all! This question went by last month without a reply, so I am going to try it again. I've also gotten a bit closer to the answer on my own. --------- The layout: Most of my code is in a Python Product, but there is still a bunch of dtml used. I have a class called "person" with a string variable called "name", and a class called "event" with a list variable called "eventnames". Now when a addEventForm is filled out, then the viewEventPage is called, I want all the people listed in "eventnames" to have a link to thier home page if they exist. --------- The DTML attempt: I could never get this to work correctly. Becuase it is looking through two lists, the code causes the "eventnames" to be dispayed once for each person listed. <dtml-if eventnames><BR><BR><STRONG>Featuring people :</STRONG> <dtml-with "PARENTS[0]"> <dtml-in personValues> <dtml-if "meta_type == 'SRPersonPost'"> <dtml-in eventnames> <dtml-if "_['sequence-item'] == name"> <A href="<dtml-var site_url>/<dtml-var id>"><dtml-var sequence-item></a>, <dtml-else><dtml-var sequence-item>, </dtml-if> </dtml-in> </dtml-if> </dtml-in> </dtml-with> </dtml-if eventnames> --------- The Python attempt: So I tried to change my strategy, and build a method to find the matches, and return the list with the ids (if the person is listed) or a 'None' if they are not listed. I haven't been able to figure out what is going wrong with this. def list_dj_list(self, namelist): """ should return a list of names & IDs from a list of names """ rlist = map(None,self.ids) rlist = filter(lambda x,p=self : p.data[x].validated, rlist) rlist = filter(lambda x,p=self : p.data[x].meta_type == 'SRPersonPost', rlist) rlist = filter(lambda x,p=self : p.data[x].name, rlist) rnames = [] for i in range(len(namelist)): rnamelist = rlist rname = filter(lambda x,p=self,s=namelist[i] : p.data[x].name == s, rnamelist) if len(rnames) == 0: rnames.append('None') elif len(rnames) == 1: rnames.append(rname) else: rnames.append('multiples') return rnames --------- The question: How can this be achieved? I don't have a preferance over dtml or python, but it seems like a python method is the proper way to do it. Thanks for any help! -ed- _______________________________________________ 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 )