def get_entry_objects(entry_list):
"""
Retrieve a list of (entry, data_obj) pairs.
"""
# Grouping these together like this just to minimize the number of calls
# to get_database_table.
author_table = dh.get_database_table('authors')
for table_name, group in it.groupby(entry_list, key=lambda x: x.table):
table = dh.get_database_table(table_name)
for entry_obj in group:
data_obj = table[entry_obj.data_id]
# Retrieve the author objects as well
author_objs = [author_table[author_id] for author_id in data_obj.author_ids]
yield (entry_obj, data_obj, author_objs)
评论列表
文章目录