In this case, I want to spit out the print of the ------------- id
--------------- once per entry which has a value and not at all for entries
w/o values; so, I think the current flow is right. (Your other comments,
however, are spot on)


On Fri, Oct 25, 2013 at 12:58 PM, Carlos Andrés Rocha <
notifications@github.com> wrote:

> In cms/djangoapps/contentstore/management/commands/course_id_clash.py:
>
> > +                {'inline': True},
> > +                query={'_id.category': 'course'},
> > +                finalize='''
> > +                function(key, reduced) {
> > +                    if (Array.isArray(reduced.target)) {
> > +                        return reduced;
> > +                    }
> > +                    else {return null;}
> > +                    }
> > +                '''
> > +            )
> > +            results = results.get('results')
> > +            for entry in results:
> > +                if entry.get('value') is not None:
> > +                    print '{:-^40}'.format(entry.get('_id'))
> > +                    for course_id in entry.get('value').get('target'):
>
> for course_id in entry.get('value', {}).get('target', []):
>    ...
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/edx/edx-platform/pull/1484/files#r7221748>
> .
>