def obj_list_dictize(obj_list, context, sort_key=(lambda x: x)):
 result_list = []
 active = context.get('active', True)
 for obj in obj_list:
  if context.get('with_capacity'):
   (obj, capacity) = obj
   dictized = table_dictize(obj, context, capacity=capacity)
  else:
   dictized = table_dictize(obj, context)
  if (active and (obj.state != 'active')):
   continue
  result_list.append(dictized)
 return sorted(result_list, key=sort_key)

def obj_list_dictize ( obj_list , context , sort_key = ( lambda x : x ) ) : result_list = [ ] active = context . get ( 'active' , True ) for obj in obj_list : if context . get ( 'with_capacity' ) : ( obj , capacity ) = obj dictized = table_dictize ( obj , context , capacity = capacity ) else : dictized = table_dictize ( obj , context ) if ( active and ( obj . state != 'active' ) ) : continue result_list . append ( dictized ) return sorted ( result_list , key = sort_key )
get a list of model object and represent it as a list of dicts .