Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use XBlock 0.3 #839

Merged
merged 1 commit into from
Sep 6, 2013
Merged

Use XBlock 0.3 #839

merged 1 commit into from
Sep 6, 2013

Conversation

cpennington
Copy link
Contributor

@nedbat @sarina @dmitchell: Can you guys review?

Scope of changes:

  1. Migrate Namespaces to mixins
    1. all references to <block>.lms.<field> and <block>.cms.<field> should now just be <block>.<field>
    2. Anywhere that a modulestore is constructed, it should be passed the appropriate mixin
    3. Anywhere a block is constructed, it should be done using on of the construct_block* methods
  2. Split up the xblock modules (core -> core, fields)
  3. Switch to the many -> 1 model for Runtimes and FieldDatas
    1. FieldData access should always be through get, set, set_many, delete, rather than the dictionary interface
    2. Those methods should always be passed a block as the first argument.
  4. Change module that use Scope.content and store it in SQL to instead use one of the new UserScope.ALL scopes

children.append(new_block)
# trigger setter method by using top level field access
parent_xblock.children = children
parent_xblock.children.append(new_block.scope_ids.usage_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the order of diffs, it's hard to tell what you've done to create a uuid/cache for in memory usage_ids; so, I'll assume that's handled.

Probably beyond the scope of this PR, but we need a new repr for children addresses which allow structure spanning: pointing to elements in other structures. As a shortcut, we could say that a simple ID implies w/in same structure and have a different repr and logic for pointers into other structures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that block locators allowed for pointers across structures.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block locators do, but I thought we were just persisting the usage_id not
the whole block usage locator.

On Tue, Sep 3, 2013 at 9:45 AM, Calen Pennington
notifications@github.comwrote:

In cms/djangoapps/contentstore/tests/test_crud.py:

@@ -226,10 +226,7 @@ def load_from_json(json_data, system, default_class=None, parent_xblock=None):

     new_block = system.xblock_from_json(class_, usage_id, json_data)
     if parent_xblock is not None:
  •        children = parent_xblock.children
    
  •        children.append(new_block)
    
  •        # trigger setter method by using top level field access
    
  •        parent_xblock.children = children
    
  •        parent_xblock.children.append(new_block.scope_ids.usage_id)
    

I thought that block locators allowed for pointers across structures.


Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/839/files#r6125662
.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be whatever id locates a particular usage (meaning, a usage inside a course). So, the usage locator, rather than the usage_id inside the locator, I guess.

@sarina
Copy link
Contributor

sarina commented Sep 3, 2013

Rebasing should pull in the changes Jason made to the bulk email tests

return (self.scope_ids == other.scope_ids and
self.fields.keys() == other.fields.keys() and
all(getattr(self, field.name) == getattr(other, field.name)
for field in self.fields.values()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner and clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to exclude mixin fields.

@dmitchell
Copy link
Contributor

We need to check whether there are unit tests and perhaps also manually test all of the views impacted by switching .fields from being local only to the union of all namespaces.

scope_map[field.scope].add(field)
return scope_map

def _cache_key_from_kvs_key(self, key):
"""
Return the key used in the ModelDataCache for the specified KeyValueStore key
Return the key used in the FieldDataCache for the specified KeyValueStore key
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function now does nothing if scope is either Scope.content or Scope.settings - is that intentional?

Same goes for _cache_key_from_field_object. If this is intentional please add comments as to why.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nm finally got to the docstring for DjangoKeyValueStore


def __ne__(self, other):
return not self == other

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this addition (good though it looks) in this pull request?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used so that the new method of checking XModule testing actually works.

@dmitchell
Copy link
Contributor

I can't seem to successfully run cms. I think I need to rebuild my dbs. The manual tests to run:

  1. course advanced settings shows the right attrs (not sure which are "right" tho) PASSED
  2. non-problem leaf components (e.g., video, html) don't have problem metadata attrs in editor FAILED
  3. problem leaf components have "right" attrs (@caherns ran this test and says it failed)
  4. exported courses have all of the right data in the right places


# We're loading a descriptor, so student_id is meaningless
# We also don't have separate notions of definition and usage ids yet,
# so we use the location for both,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Period?

@dmitchell dmitchell merged commit 8201b14 into openedx:master Sep 6, 2013
@cpennington cpennington deleted the xblock-0.3 branch September 9, 2013 13:16
chrisrossi pushed a commit to jazkarta/edx-platform that referenced this pull request Mar 31, 2014
ny0m pushed a commit to open-craft/edx-platform that referenced this pull request Aug 31, 2017
ny0m pushed a commit to open-craft/edx-platform that referenced this pull request Aug 31, 2017
ziafazal pushed a commit that referenced this pull request Dec 12, 2017
kluo pushed a commit to kluo/edx-platform that referenced this pull request Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants