Cool, I've updated the function with the new format -- will push shortly


On Mon, May 12, 2014 at 2:21 PM, David Ormsbee <notifications@github.com>wrote:

> In lms/djangoapps/api_manager/courses/views.py:
>
> > -    data = _serialize_module(
> > +def _serialize_content_groups(request, course_id, content_id, groups):
> > +    """
> > +    Loads the specified content group data into the response dict
> > +    This should probably evolve to use DRF serializers
> > +    """
> > +    data = []
> > +    if groups:
> > +        for group in groups:
> > +            group_data = {
> > +                'course_id': course_id,
> > +                'content_id': content_id,
> > +                'group_id': group.group_id
> > +            }
> > +            data.append(group_data)
> > +    return data
>
> Assuming groups is always an iterable (even if it's an empty one), this
> can also simplify down to:
>
> return [
>     {'course_id': course_id, 'content_id': content_id, 'group_id': group.group_id}
>     for group in groups]
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/edx-solutions/edx-platform/pull/42/files#r12545096>
> .
>



-- 
Matthew Drayer
Solutions Architect
edX | MIT
mattdrayer@edx.org