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

Modulestore Support for Content libraries (Part of SOL-1, SOL-2, SOL-3) #6033

Merged
merged 1 commit into from
Dec 8, 2014

Conversation

bradenmacdonald
Copy link
Contributor

@cpennington @dmitchell @doctoryes @antoviaque @explorerleslie @cahrens

Background: This is the technical foundation required for Content Libraries. It is considered part of SOL-1, SOL-2, and SOL-3, with the corresponding UI changes separated out into #6046.

Discussion: Architecture discussed extensively on the wiki and in meetings, then the revised proposal was presented to the Arch Council on Oct. 21 and given thumbs up.

Partner information: 3rd party-hosted open edX instance, for an edX solutions client.

Merge deadline: ASAP - several other PRs are ready and blocking on this.

Dependencies: Requires openedx/opaque-keys#46, which is already merged.

@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald! I've created OSPR-224 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams.

Feel free to add as much of the following information to the ticket:

  • supporting documentation
  • edx-code email threads
  • timeline information ('this must be merged by XX date', and why that is)
  • partner information ('this is a course on edx.org')
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will still be done via the Github pull request interface. As a reminder, our process documentation is here.

@cahrens
Copy link

cahrens commented Nov 24, 2014

Thanks for the heads-up, @bradenmacdonald. I think a code review by the architecture team is sufficient for this PR (T&L does not need to review).

@sarina
Copy link
Contributor

sarina commented Nov 25, 2014

@bradenmacdonald this PR needs a rebase

def get_libraries(self, **kwargs):
'''
Returns a list containing the top level XModuleDescriptors of the libraries in this modulestore.
'''
Copy link
Contributor

Choose a reason for hiding this comment

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

Stylistically prefer """ rather than '''

@sarina
Copy link
Contributor

sarina commented Nov 25, 2014

Looks good at a brief pass from me. Handing off to the Platform team. Braden please be sure to rebase ASAP to get review attention.

@bradenmacdonald
Copy link
Contributor Author

Thanks @sarina and @cahrens. Fixed formatting issues and rebased.

@sarina
Copy link
Contributor

sarina commented Nov 25, 2014

@bradenmacdonald please take a look at build failures.

This is now sitting in the platform team's backlog (ie @cpennington 's team)

@@ -0,0 +1,80 @@
"""
'library' XBlock/XModule
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't this just be a pure XBlock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • When I wrote it, pure XBlocks didn't support children, and I was just copying the similar XModule used as the root of course structures. I can try converting this to an XBlock, though - it would be nicer.

Copy link
Contributor

Choose a reason for hiding this comment

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

@doctoryes is in the middle of testing a fix to a bug that might hit you if this is a pure XBlock, but I think it would be good to try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cpennington Good news: I converted it to an XBlock and it seems to work well: b0662e7

Two questions for you:

  • I left it in the xmodule folder and tweaked xmodule's setup.py as you can see in the commit - is this good, or is there some other place that new core XBlocks should go?
  • The new XBlock has no JavaScript (never calls initialize_js) and is a pure XBlock, so when I view the library in studio, the initializeBlock coffeescript code logs an error to the JS console saying its DIV is missing data-runtime, data-runtime-version or data-init, and can't be initialized. This doesn't cause any problems, but creates a very long trace in the console as the entire HTML of the XBlock is logged with that error. Can I remove that console.log warning, or is there something I need to change/implement in the new XBlock?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm. I guess leaving it in xmodule for now is fine, until we can split all of the core xblocks out into a separate repo entirely.

It seems like we should tweak that logging so that it only logs if it has some but not all of the data that it needs, rather than logging if it has none of them.

@bradenmacdonald
Copy link
Contributor Author

@sarina There are no build failures - just a single TODO comment in the quality check that's causing it to say tests failed.

@bradenmacdonald
Copy link
Contributor Author

Whoops - fat fingers. Didn't mean to close this PR just now.

@sarina
Copy link
Contributor

sarina commented Dec 1, 2014

@bradenmacdonald this PR needs a rebase

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Dec 1, 2014
assert(isinstance(library_key, LibraryLocator))
store = self._get_modulestore_for_courseid(library_key)
if not hasattr(store, 'get_library'):
return None # This key seems invalid since its modulestore doesn't support libraries
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think self._get_modulestore_for_courseid will ever return a store which will not support libraries. I don't think it's possible.

""" XML support not yet implemented. """
raise NotImplementedError

def export_to_xml(self, resource_fs):
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be parse_xml and add_xml_to_node, the XBlock serialization methods (rather than the XModule serialization methods you're defining now).

@dmitchell
Copy link
Contributor

mostly 👍 w/ some possible noop questions. I'm curious how you're implementing the use of library content in a course esp after talking to @brianhw. I'll go back and read your spec again, but I'm wondering about maintaining block identity across course-like boundaries esp if used > 1x in borrowing course.

root_block['edit_info']['previous_version'] = root_block['edit_info'].get('update_version')
root_block['edit_info']['update_version'] = new_id
old_def = self.get_definition(locator, root_block['definition'])
new_fields = old_def['fields']
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't doing the deepcopy that the old code did, is it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok.

@e-kolpakov e-kolpakov force-pushed the content-libraries branch 2 times, most recently from 975bf82 to 48354f7 Compare December 4, 2014 12:48
@e-kolpakov
Copy link
Contributor

Squashed commits in order to prepare PR to merging.

@openedx-webhooks openedx-webhooks added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Dec 5, 2014
@cpennington
Copy link
Contributor

A few minor niggles, but 👍

antoviaque added a commit that referenced this pull request Dec 8, 2014
Modulestore Support for Content libraries (Part of SOL-1, SOL-2, SOL-3)
@antoviaque antoviaque merged commit f561e79 into openedx:master Dec 8, 2014
@bradenmacdonald bradenmacdonald deleted the content-libraries branch December 10, 2014 02:31
@bradenmacdonald bradenmacdonald mentioned this pull request Jan 6, 2015
10 tasks
@sarina sarina added the open-source-contribution PR author is not from Axim or 2U label Apr 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engineering review open-source-contribution PR author is not from Axim or 2U waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants