Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
efdaa047
Commit
efdaa047
authored
Jan 27, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert more prints to logging
parent
ab00c788
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
courseware/modules/video_module.py
+22
-18
settings_new_askbot.py
+1
-1
No files found.
courseware/modules/video_module.py
View file @
efdaa047
from
x_module
import
XModule
import
logging
from
lxml
import
etree
import
json
import
json
## TODO: Abstract out from Django
## TODO: Abstract out from Django
from
django.conf
import
settings
from
django.conf
import
settings
from
djangomako.shortcuts
import
render_to_response
,
render_to_string
from
djangomako.shortcuts
import
render_to_response
,
render_to_string
from
lxml
import
etree
from
x_module
import
XModule
log
=
logging
.
getLogger
(
"mitx.courseware.modules"
)
class
VideoModule
(
XModule
):
class
VideoModule
(
XModule
):
#id_attribute = 'youtube'
#id_attribute = 'youtube'
video_time
=
0
video_time
=
0
def
handle_ajax
(
self
,
dispatch
,
get
):
def
handle_ajax
(
self
,
dispatch
,
get
):
print
"GET"
,
get
log
.
debug
(
u"GET {0}"
.
format
(
get
))
print
"DISPATCH"
,
dispatch
log
.
debug
(
u"DISPATCH {0}"
.
format
(
dispatch
))
if
dispatch
==
'goto_position'
:
if
dispatch
==
'goto_position'
:
self
.
position
=
int
(
float
(
get
[
'position'
]))
self
.
position
=
int
(
float
(
get
[
'position'
]))
print
"NEW POSITION"
,
self
.
position
log
.
debug
(
u"NEW POSITION {0}"
.
format
(
self
.
position
))
return
json
.
dumps
({
'success'
:
True
})
return
json
.
dumps
({
'success'
:
True
})
raise
Http404
()
raise
Http404
()
def
get_state
(
self
):
def
get_state
(
self
):
print
"STATE POSITION"
,
self
.
position
log
.
debug
(
u"STATE POSITION {0}"
.
format
(
self
.
position
))
return
json
.
dumps
({
'position'
:
self
.
position
})
return
json
.
dumps
({
'position'
:
self
.
position
})
def
get_xml_tags
():
def
get_xml_tags
():
'''
Tags in the courseware file guaranteed to correspond to the module
'''
'''
Tags in the courseware file guaranteed to correspond to the module
'''
return
"video"
return
"video"
def
video_list
(
self
):
def
video_list
(
self
):
l
=
self
.
youtube
.
split
(
','
)
l
=
self
.
youtube
.
split
(
','
)
l
=
[
i
.
split
(
":"
)
for
i
in
l
]
l
=
[
i
.
split
(
":"
)
for
i
in
l
]
return
json
.
dumps
(
dict
(
l
))
return
json
.
dumps
(
dict
(
l
))
def
get_html
(
self
):
def
get_html
(
self
):
...
@@ -39,24 +42,25 @@ class VideoModule(XModule):
...
@@ -39,24 +42,25 @@ class VideoModule(XModule):
'position'
:
self
.
position
})
'position'
:
self
.
position
})
def
get_init_js
(
self
):
def
get_init_js
(
self
):
'''
JavaScript code to be run when problem is shown. Be aware
'''JavaScript code to be run when problem is shown. Be aware
that this may happen several times on the same page
that this may happen several times on the same page
(e.g. student switching tabs). Common functions should be put
(e.g. student switching tabs). Common functions should be put
in the main course .js files for now. '''
in the main course .js files for now. '''
print
"INIT POSITION"
,
self
.
position
log
.
debug
(
u"INIT POSITION {0}"
.
format
(
self
.
position
))
return
render_to_string
(
'video_init.js'
,{
'streams'
:
self
.
video_list
(),
return
render_to_string
(
'video_init.js'
,{
'streams'
:
self
.
video_list
(),
'id'
:
self
.
item_id
,
'id'
:
self
.
item_id
,
'position'
:
self
.
position
})
'position'
:
self
.
position
})
def
get_destroy_js
(
self
):
def
get_destroy_js
(
self
):
return
"videoDestroy(
\"
"
+
self
.
item_id
+
"
\"
);"
return
"videoDestroy(
\"
{0}
\"
);"
.
format
(
self
.
item_id
)
def
__init__
(
self
,
xml
,
item_id
,
ajax_url
=
None
,
track_url
=
None
,
state
=
None
,
track_function
=
None
,
render_function
=
None
):
def
__init__
(
self
,
xml
,
item_id
,
ajax_url
=
None
,
track_url
=
None
,
state
=
None
,
track_function
=
None
,
render_function
=
None
):
XModule
.
__init__
(
self
,
xml
,
item_id
,
ajax_url
,
track_url
,
state
,
track_function
,
render_function
)
XModule
.
__init__
(
self
,
xml
,
item_id
,
ajax_url
,
track_url
,
state
,
track_function
,
render_function
)
self
.
youtube
=
etree
.
XML
(
xml
)
.
get
(
'youtube'
)
self
.
youtube
=
etree
.
XML
(
xml
)
.
get
(
'youtube'
)
self
.
position
=
0
self
.
position
=
0
if
state
!=
None
:
if
state
!=
None
:
state
=
json
.
loads
(
state
)
state
=
json
.
loads
(
state
)
if
'position'
in
state
:
self
.
position
=
int
(
float
(
state
[
'position'
]))
if
'position'
in
state
:
print
"POOSITION IN STATE"
self
.
position
=
int
(
float
(
state
[
'position'
]))
print
"LOAD POSITION"
,
self
.
position
log
.
debug
(
"POSITION IN STATE"
)
log
.
debug
(
u"LOAD POSITION {0}"
.
format
(
self
.
position
))
settings_new_askbot.py
View file @
efdaa047
...
@@ -155,7 +155,7 @@ LOGGING = {
...
@@ -155,7 +155,7 @@ LOGGING = {
'stream'
:
sys
.
stderr
,
'stream'
:
sys
.
stderr
,
},
},
'app'
:
{
'app'
:
{
'level'
:
'INFO'
,
'level'
:
'
DEBUG'
if
DEBUG
else
'
INFO'
,
'class'
:
'logging.handlers.TimedRotatingFileHandler'
,
'class'
:
'logging.handlers.TimedRotatingFileHandler'
,
'formatter'
:
'standard'
,
'formatter'
:
'standard'
,
'filename'
:
LOG_DIR
+
'/mitx.log'
,
# temporary location for proof of concept
'filename'
:
LOG_DIR
+
'/mitx.log'
,
# temporary location for proof of concept
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment