From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Tim Hicks >I am trying to create a zope product in python but have got stuck with using the >dtml-in tag to iterate over a method (or is it a function? I get a little mixed >up) of my class. Here is the method, def list_messages(self): msgList = [] lr = open(self.user_dir+'/msg_list', 'r') spl = re.compile('\s\|\s') for msg_line in lr.readline(): num_from_sub = [] num_from_sub = spl.split(msg_line, 2) print num_from_sub self.msgnum = num_from_sub[0] self.msgfrom = 'This is from UNKNOWN' self.msgsub = 'My special subject' return self.msgnum, self.msgfrom, self.msgsub return msgList The dtml-in does not call your method for every iteration, it just calls once and then expects a list in return. What you need to do is to create a method that returns a list of objects: def list_messages(self): class msg: def __init__(self, msgnum, msgfrom, msgsub): self.msgnum = msgnum self.msgfrom = msgfrom self.msgsub = msgsub msgList = [] lr = open(self.user_dir+'/msg_list', 'r') spl = re.compile('\s\|\s') for msg_line in lr.readline(): num_from_sub = [] num_from_sub = spl.split(msg_line, 2) # Oh no ... this wont cut it! #self.msgnum = num_from_sub[0] #self.msgfrom = 'This is from UNKNOWN' #self.msgsub = 'My special subject' #return self.msgnum, self.msgfrom, self.msgsub # Do it like this: msgList.append(msg(num_from_sub[0],'This is from UNKNOWN', 'My special subject')) return msgList _______________________________________________ Zope maillist - [EMAIL PROTECTED] 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 )