Possibly: XC=DBSession.query(corporations).filter_by (corporationID=al.executorCorpID).all()
On Jun 11, 10:49 am, AlienBaby <[email protected]> wrote: > @expose('browseeve.templates.ShowAllianceList') > def ShowAllianceList(self): > alinfo=DBSession.query(alliances) > XCinfo={}; > for al in alinfo: > XC=DBSession.query(corporations).filter_by > (corporationID=al.executorCorpID) > XCinfo[al.allianceID]=XC > """Display alliance table.""" > return dict(alinfo=alinfo, XCinfo=XCinfo) However, you might consider: class alliances(DeclarativeBase): """ model here """ executorCorpID = Column(Unicode(255), nullable=False) """ rest of model """ corporation = relation('corporations', backref='alliances') > class corporations(DeclarativeBase): > __tablename__ = 'corporations' > > #{ Columns > id = Column(Integer, primary_key=True) > corporationID = Column(Unicode(255), nullable=False, > ForeignKey('alliances.executorCorpID')) > corporationName = Column(Unicode(255), nullable=False) > ticker = Column(Unicode(255), nullable=False) > ceoID = Column(Unicode(255), nullable=False) > ceoName = Column(Unicode(255), nullable=False) > stationID = Column(Unicode(255), nullable=False) > stationName = Column(Unicode(255), nullable=False) > description = Column(Unicode(255), nullable=True) > url = Column(Unicode(255), nullable=True) > allianceID = Column(Unicode(255), nullable=True) > allianceName = Column(Unicode(255), nullable=True) > taxRate = Column(Unicode(255), nullable=False) > memberCount = Column(Unicode(255), nullable=False) > shares = Column(Unicode(255), nullable=False) > #} at which point: > @expose('browseeve.templates.ShowAllianceList') > def ShowAllianceList(self): > alinfo=DBSession.query(alliances).all() > return dict(alinfo=alinfo) results in: <table> <tr><th>blah</th><th>blah</th><th>blah</th><th>blah</th></tr> <py:for each="i,task in enumerate(alinfo)" class="${i%2 and 'odd' or 'even'}"> <tr> <td><strong>${alinfo.blah}</strong></td> <td><strong>${alinfo.blah2}</strong></td> <td><strong>${alinfo.blah3}</strong></td> <td><strong>${alinfo.blah4}</strong></td> </tr> <tr py:for="corp in alinfo.corporation"> <td></td> <td>${corp.ticker}</td> <td>${corp.ceoname}</td> <td>${corp.whatever}</td> </tr> </py:for> </table> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

