Commit 725ff4cb by Jonathan Piacenti

Refinement of ID handling when scoping export.

parent c338a1e2
......@@ -32,6 +32,7 @@ from problem_builder.sub_api import SubmittingXBlockMixin
loader = ResourceLoader(__name__)
# Make '_' a no-op so we can scrape strings
def _(text):
return text
......@@ -164,9 +165,10 @@ class DataExportBlock(SubmittingXBlockMixin, XBlock):
root_block_id = unicode(self.scope_ids.usage_id)
get_root = True
else:
self.runtime.course_id.make_usage_key(root_block_id)
from xmodule.modulestore.django import modulestore
block = modulestore().get_items(self.runtime.course_id, qualifiers={'name': root_block_id}, depth=0)[0]
root_block_id = unicode(block.location)
get_root = False
print root_block_id
user_service = self.runtime.service(self, 'user')
if not self.user_is_staff():
return {'error': 'permission denied'}
......
......@@ -25,7 +25,6 @@ def export_data(source_block_id_str, block_types, user_id, get_root=True):
start_timestamp = time.time()
logger.debug("Beginning data export")
try:
block_key = UsageKey.from_string(source_block_id_str)
src_block = modulestore().get_item(block_key)
......
......@@ -13,9 +13,6 @@
<div class="export-options">
<div>
<label><input type="checkbox" name="filter_blocks" />{% trans "Filter by block type" %}</label>
</div>
<div>
<label>
{% trans "Select which blocks to filter by (selecting none will grab all types):" %}
<select multiple name="block_types">
......@@ -27,7 +24,7 @@
</div>
<div>
<label>
{% trans "Input the Usage ID of a chapter, section, or unit if you wish to only get results under it. Otherwise, it will grab all results for the course." %}
{% trans "Input the ID of a chapter, section, or unit if you wish to only get results under it. Otherwise, it will grab all results for the course." %}
<input type="text" name="root_block_id" />
</label>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment