Commit ff026ea8 by Calen Pennington

Merge remote-tracking branch 'edx/master' into opaque-keys-merge-master

Conflicts:
	common/lib/xmodule/xmodule/video_module/video_handlers.py
parents ddf1874c de637f32
......@@ -36,6 +36,9 @@ def import_static_content(
policy = {}
verbose = True
mimetypes.add_type('application/octet-stream', '.sjson')
mimetypes.add_type('application/octet-stream', '.srt')
mimetypes_list = mimetypes.types_map.values()
for dirname, _, filenames in os.walk(static_dir):
......
......@@ -194,12 +194,27 @@ class VideoStudentViewHandlers(object):
transcript_name = self.sub
if transcript_name:
<<<<<<< HEAD
course = self.descriptor.runtime.modulestore.get_course(self.course_id)
if course.static_asset_path:
=======
course_location = CourseDescriptor.id_to_location(self.course_id)
# Get the asset path for course
asset_path = None
if hasattr(self.descriptor.runtime, 'modulestore'):
course = self.descriptor.runtime.modulestore.get_item(course_location)
asset_path = course.static_asset_path
else:
# Handle XML Courses that don't have modulestore in the runtime
asset_path = getattr(self.descriptor, 'data_dir', None)
if asset_path:
>>>>>>> edx/master
response = Response(
status=307,
location='/static/{0}/{1}'.format(
course.static_asset_path,
asset_path,
subs_filename(transcript_name, self.transcript_language)
)
)
......
......@@ -111,4 +111,36 @@ External page reference
see `Create a Problem <http://site.Create_Problem.html>`_
\ No newline at end of file
*******
Tables
*******
Example of a table with a cell that includes a bulleted list. The balnk lines before and after are critical.
.. list-table::
:widths: 15 15 60
:header-rows: 1
* - Field
- Type
- Details
* - ``correct_map``
- dict
- For each problem ID value listed by ``answers``, provides:
* ``correctness``: string; 'correct', 'incorrect'
* ``hint``: string; Gives optional hint. Nulls allowed.
* ``hintmode``: string; None, 'on_request', 'always'. Nulls allowed.
* ``msg``: string; Gives extra message response.
* ``npoints``: integer; Points awarded for this ``answer_id``. Nulls allowed.
* ``queuestate``: dict; None when not queued, else ``{key:'', time:''}``
where ``key`` is a secret string dump of a DateTime object in the form
'%Y%m%d%H%M%S'. Nulls allowed.
* - ``grade``
- integer
- Current grade value.
* - ``max_grade``
- integer
- Maximum possible grade value.
\ No newline at end of file
......@@ -14,6 +14,7 @@ This document is intended for researchers and data czars at edX partner institut
internal_data_formats/discussion_data.rst
internal_data_formats/wiki_data.rst
internal_data_formats/tracking_logs.rst
internal_data_formats/event_list.rst
********************
......
.. _event_list:
##############
Event List
##############
.. list-table::
:widths: 30 30
:header-rows: 1
* - Event
- Description
* - ``add-forum-admin``
- :ref:`Instructor_Event_Types`
* - ``add-forum-community-TA``
- :ref:`Instructor_Event_Types`
* - ``add-forum-mod``
- :ref:`Instructor_Event_Types`
* - ``add-instructor``
- :ref:`Instructor_Event_Types`
* - ``add-or-remove-user-group``
- :ref:`Instructor_Event_Types`
* - ``assigned_user_to_partition``
- :ref:`AB_Event_Types`
* - ``peer_grading_show_question``
- :ref:`ora`
* - ``book``
- :ref:`pdf`
* - ``calculate_grades_csv``
- :ref:`Instructor_Event_Types`
* - ``child_render``
- :ref:`AB_Event_Types`
* - ``delete-student-module-state``
- :ref:`Instructor_Event_Types`
* - ``dump_grades``
- :ref:`Instructor_Event_Types`
* - ``edx.course.enrollment.activated``
- :ref:`enrollment` and :ref:`instructor_enrollment`
* - ``edx.course.enrollment.deactivated``
- :ref:`enrollment` and :ref:`instructor_enrollment`
* - ``get_anon_ids``
- :ref:`Instructor_Event_Types`
* - ``get_student_progress_page``
- :ref:`Instructor_Event_Types`
* - ``get_student_progress_url``
- :ref:`Instructor_Event_Types`
* - ``get_students_features``
- :ref:`Instructor_Event_Types`
* - ``get_students_features/csv``
- :ref:`Instructor_Event_Types`
* - ``instructor``
- :ref:`Instructor_Event_Types`
* - ``list-beta-testers``
- :ref:`Instructor_Event_Types`
* - ``list-forum-admins``
- :ref:`Instructor_Event_Types`
* - ``list-forum-community-TAs``
- :ref:`Instructor_Event_Types`
* - ``list-forum-mods``
- :ref:`Instructor_Event_Types`
* - ``list-instructors``
- :ref:`Instructor_Event_Types`
* - ``list-staff``
- :ref:`Instructor_Event_Types`
* - ``list-students``
- :ref:`Instructor_Event_Types`
* - ``modify_access``
- :ref:`Instructor_Event_Types`
* - ``oe_feedback_response_selected``
- :ref:`ora`
* - ``oe_hide_question``
- :ref:`ora`
* - ``oe_show_full_feedback``
- :ref:`ora`
* - ``oe_show_question``
- :ref:`ora`
* - ``oe_show_respond_to_feedback``
- :ref:`ora`
* - ``page_close``
- :ref:`navigational`
* - ``pause_video``
- :ref:`video`
* - ``peer_grading_hide_question``
- :ref:`ora`
* - ``peer_grading_show_question``
- :ref:`ora`
* - ``play_video``
- :ref:`video`
* - ``problem_check``
- :ref:`problem`
* - ``problem_check_fail``
- :ref:`problem`
* - ``problem_rescore``
- :ref:`problem`
* - ``problem_rescore_fail``
- :ref:`problem`
* - ``problem_save``
- :ref:`problem`
* - ``problem_show``
- :ref:`problem`
* - ``psychometrics-histogram-generation``
- :ref:`Instructor_Event_Types`
* - ``remove-forum-admin``
- :ref:`Instructor_Event_Types`
* - ``remove-forum-community-TA``
- :ref:`Instructor_Event_Types`
* - ``remove-forum-mod``
- :ref:`Instructor_Event_Types`
* - ``remove-instructor``
- :ref:`Instructor_Event_Types`
* - ``rescore-all-submissions``
- :ref:`Instructor_Event_Types`
* - ``rescore-student-submission``
- :ref:`Instructor_Event_Types`
* - ``reset-all-attempts``
- :ref:`Instructor_Event_Types`
* - ``reset_problem``
- :ref:`problem`
* - ``reset_problem_fail``
- :ref:`problem`
* - ``reset-student-attempts``
- :ref:`Instructor_Event_Types`
* - ``rubric_select``
- :ref:`ora`
* - ``save_problem_fail``
- :ref:`problem`
* - ``save_problem_success``
- :ref:`problem`
* - ``seek_video``
- :ref:`video`
* - ``seq_goto``
- :ref:`navigational`
* - ``seq_next``
- :ref:`navigational`
* - ``seq_prev``
- :ref:`navigational`
* - ``show_answer``
- :ref:`problem`
* - ``speed_change_video``
- :ref:`video`
* - ``staff_grading_hide_question``
- :ref:`ora`
* - ``staff_grading_show_question``
- :ref:`ora`
* - ``textbook.pdf.chapter.navigated``
- :ref:`pdf`
* - ``textbook.pdf.display.scaled``
- :ref:`pdf`
* - ``textbook.pdf.display.scrolled``
- :ref:`pdf`
* - ``textbook.pdf.outline.toggled``
- :ref:`pdf`
* - ``textbook.pdf.page.navigated``
- :ref:`pdf`
* - ``textbook.pdf.search.casesensitivity.toggled``
- :ref:`pdf`
* - ``textbook.pdf.search.executed``
- :ref:`pdf`
* - ``textbook.pdf.search.highlight.toggled``
- :ref:`pdf`
* - ``textbook.pdf.search.navigatednext``
- :ref:`pdf`
* - ``textbook.pdf.thumbnails.navigated``
- :ref:`pdf`
* - ``textbook.pdf.thumbnails.toggled``
- :ref:`pdf`
* - ``textbook.pdf.zoom.buttons.changed``
- :ref:`pdf`
* - ``textbook.pdf.zoom.menu.changed``
- :ref:`pdf`
* - ``update_forum_role_membership``
- :ref:`Instructor_Event_Types`
.. * - ``hide_transcript``
.. - :ref:`video`
.. * - ``load_video``
.. - :ref:`video`
.. * - ``problem_graded``
.. - :ref:`problem`
.. * - ``problem_reset``
.. - :ref:`problem`
.. * - ``show_transcript``
.. - :ref:`video`
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -437,6 +437,42 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
response = self.item.transcript(request=request, dispatch='translation/uk')
self.assertEqual(response.status, '404 Not Found')
def test_xml_transcript(self):
"""
Set data_dir and remove runtime modulestore to simulate an XMLModuelStore course.
Then run the same tests as static_asset_path run.
"""
# Simulate XMLModuleStore xmodule
self.item_descriptor.data_dir = 'dummy/static'
del self.item_descriptor.runtime.modulestore
self.assertFalse(self.course.static_asset_path)
# Test youtube style en
request = Request.blank('/translation/en?videoId=12345')
response = self.item.transcript(request=request, dispatch='translation/en')
self.assertEqual(response.status, '307 Temporary Redirect')
self.assertIn(
('Location', '/static/dummy/static/subs_12345.srt.sjson'),
response.headerlist
)
# Test HTML5 video style
self.item.sub = 'OEoXaMPEzfM'
request = Request.blank('/translation/en')
response = self.item.transcript(request=request, dispatch='translation/en')
self.assertEqual(response.status, '307 Temporary Redirect')
self.assertIn(
('Location', '/static/dummy/static/subs_OEoXaMPEzfM.srt.sjson'),
response.headerlist
)
# Test different language to ensure we are just ignoring it since we can't
# translate with static fallback
request = Request.blank('/translation/uk')
response = self.item.transcript(request=request, dispatch='translation/uk')
self.assertEqual(response.status, '404 Not Found')
class TestStudioTranscriptTranslationGetDispatch(TestVideo):
"""
......
import json
import sys
import traceback
try:
import dateutil.parser
except ImportError:
def date_string(ds, fmt=''):
return ds
else:
def date_string(ds, fmt='%Y-%m-%d %H:%M:%S.%f'):
d = dateutil.parser.parse(ds).astimezone(dateutil.tz.tzutc())
return d.strftime(fmt)
def display(message):
print '{} - {}'.format(date_string(message['time']), message['event_type'])
if message.get('event'):
event = json.loads(message['event'])
for k in sorted(event):
print '\t{}: {}'.format(k, event[k])
print
while 1:
line = sys.stdin.readline()
if not line:
break
try:
obj = json.loads(line)
display(obj)
except Exception:
traceback.print_exc()
continue
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