I have a Declarative Base model that is laid out like: content -> page -> block block block
block is a meta that points to a block table and a further object of element. page is a many to many to block placement, but, is a one to one to block, blocks is a many to many to elements. As part of the processing in the template, I need to pass content.page.block[1] to a mako function where [1] is determined by a match on the one to one name. Basically, I need to get the position of: content.page.blocks[].block.name where block.name = 'whatever' so that I can pass content.page.blocks to my mako function. As a temporary workaround, I've done the following which loops through the objects, but, is there any way to force SQLAlchemy to use a dictionary rather than a list when addressing blocks? <%def name='element(blockname, content)'> <% print content.page.blocks[0].block.name %> % for block in content.page.blocks: % if block.block.name == blockname: % for element in block.elements: <% output = getattr(h.CMS(), element.element.function)() %> ${output} % endfor % endif % endfor </%def> In this situation, I need to know if content.page.blocks[0].block.name == blockname and then pass content.page.blocks to h.CMS(). Or am I missing something obvious here? Thank you. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.