I was wondering but didn't check. Should I make that change or go as is?


On Thu, Jul 18, 2013 at 3:59 PM, Calen Pennington
<notifications@github.com>wrote:

> In cms/djangoapps/contentstore/views/item.py:
>
> > +# plausible use cases for distinct fields w/ same name in different namespaces on the same blocks.
> > +# The idea is that consumers of the xblock, and particularly the web client, shouldn't know about our internal
> > +# representation (namespaces as means of decorating all modules).
> > +# Given top-level access, the calls can simply be setattr(existing_item, field, value) ...
> > +# Really, this method should be elsewhere (e.g., xblock). We also need methods for has_value (v is_default)...
> > +def _get_xblock_field(xblock, field_name):
> > +    """
> > +    A temporary function to get the xblock field either from the xblock or one of its namespaces by name.
> > +    :param xblock:
> > +    :param field_name:
> > +    """
> > +    for field in xblock.fields:
> > +        if field.name == field_name:
> > +            return field
> > +    for namespace in xblock.namespaces:
> > +        found = getattr(getattr(xblock, namespace).__class__, field_name, False)
>
> You can actually loop through namespace.fields in the same way that you
> loop through xblock.fields.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/edx/edx-platform/pull/421/files#r5277506>
> .
>