I hijacked this methon in x_module b/c it wasn't being used anywhere and
made it serve the new persistence factory and other tests. When I
refactored the existing factory, I made a slightly incompatible api.
Perhaps I should reconcile them, but this change should be innocuous b/c no
code other than the split mongo code and factories calls this method.


On Thu, Jul 11, 2013 at 4:30 PM, Calen Pennington
<notifications@github.com>wrote:

> In common/lib/xmodule/xmodule/x_module.py:
>
> > +        json_data:
> > +        - 'category': the xmodule category (required)
> > +        - 'metadata': a dict of locally set metadata (not inherited)
> > +        - 'children': a list of children's usage_ids w/in this course
> > +        - 'definition':
> > +        - '_id' (optional): the usage_id of this. Will generate one if not given one.
> > +        """
> > +        usage_id = json_data.get('_id', None)
> > +        if not '_inherited_metadata' in json_data and parent_xblock is not None:
> > +            json_data['_inherited_metadata'] = parent_xblock.xblock_kvs.get_inherited_metadata().copy()
> > +            json_metadata = json_data.get('metadata', {})
> > +            for field in inheritance.INHERITABLE_METADATA:
> > +                if field in json_metadata:
> > +                    json_data['_inherited_metadata'][field] = json_metadata[field]
> > +
> > +        new_block = system.xblock_from_json(cls, usage_id, json_data)
>
> `xblock_from_json` isn't defined anywhere. (Except in #271<https://github.com/edx/edx-platform/issues/271>
> ).
> … <#13fcf6dc92b48ffb_>
> On Thu, Jul 11, 2013 at 3:56 PM, Christina Roberts <
> notifications@github.com > wrote: In
> common/lib/xmodule/xmodule/x_module.py: > + json_data: > + - 'category':
> the xmodule category (required) > + - 'metadata': a dict of locally set
> metadata (not inherited) > + - 'children': a list of children's usage_ids
> w/in this course > + - 'definition': > + - '_id' (optional): the usage_id
> of this. Will generate one if not given one. > + """ > + usage_id =
> json_data.get('_id', None) > + if not '_inherited_metadata' in json_data
> and parent_xblock is not None: > + json_data['_inherited_metadata'] =
> parent_xblock.xblock_kvs.get_inherited_metadata().copy() > + json_metadata
> = json_data.get('metadata', {}) > + for field in inheritance.INHERITABLE_
> METADATA: > + if field in json_metadata: > +
> json_data['_inherited_metadata'][field] = json_metadata[field] > + > +
> new_block = system.xblock_from_json(cls, usage_id, json_data) I am also
> still concerned about iterating through inheritance.INHERITABLE_METADATA.
> I'm not sure if that is what your comment refers to. — Reply to this email
> directly or view it on GitHub<
> https://github.com/edx/edx-platform/pull/270/files#r5150865> .
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/edx/edx-platform/pull/270/files#r5151788>
> .
>