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
4a288499
Commit
4a288499
authored
Jun 01, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed django.settings imports from modules/* ; changed debug prints
to use logging; added DEBUG attr to XModule class
parent
b1ac441e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
djangoapps/courseware/module_render.py
+1
-0
djangoapps/courseware/modules/capa_module.py
+3
-2
djangoapps/courseware/modules/html_module.py
+7
-3
No files found.
djangoapps/courseware/module_render.py
View file @
4a288499
...
...
@@ -37,6 +37,7 @@ class I4xSystem(object):
print
"[courseware.module_render.I4xSystem] filestore path =
%
s"
%
filestore
self
.
render_function
=
render_function
self
.
exception404
=
Http404
self
.
DEBUG
=
settings
.
DEBUG
def
__repr__
(
self
):
return
repr
(
self
.
__dict__
)
def
__str__
(
self
):
...
...
djangoapps/courseware/modules/capa_module.py
View file @
4a288499
...
...
@@ -16,7 +16,6 @@ import traceback
from
lxml
import
etree
## TODO: Abstract out from Django
from
django.conf
import
settings
from
mitxmako.shortcuts
import
render_to_string
from
x_module
import
XModule
...
...
@@ -26,6 +25,8 @@ from multicourse import multicourse_settings
log
=
logging
.
getLogger
(
"mitx.courseware"
)
#-----------------------------------------------------------------------------
class
ComplexEncoder
(
json
.
JSONEncoder
):
def
default
(
self
,
obj
):
if
isinstance
(
obj
,
complex
):
...
...
@@ -202,7 +203,7 @@ class Module(XModule):
fp
=
self
.
filestore
.
open
(
self
.
filename
)
except
Exception
,
err
:
print
'[courseware.capa.capa_module.Module.init] error
%
s: cannot open file
%
s'
%
(
err
,
self
.
filename
)
if
se
ttings
.
DEBUG
:
if
se
lf
.
DEBUG
:
# create a dummy problem instead of failing
fp
=
StringIO
.
StringIO
(
'<problem><text>Problem file
%
s is missing</text></problem>'
%
self
.
filename
)
else
:
...
...
djangoapps/courseware/modules/html_module.py
View file @
4a288499
import
json
import
logging
from
django.conf
import
settings
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
x_module
import
XModule
from
lxml
import
etree
log
=
logging
.
getLogger
(
"mitx.courseware"
)
#-----------------------------------------------------------------------------
class
Module
(
XModule
):
id_attribute
=
'filename'
...
...
@@ -26,8 +30,8 @@ class Module(XModule):
filename
=
"html/"
+
self
.
filename
return
self
.
filestore
.
open
(
filename
)
.
read
()
except
:
# For backwards compatibility. TODO: Remove
if
se
ttings
.
DEBUG
:
print
'[courseware.modules.html_module] filename=
%
s'
%
self
.
filename
if
se
lf
.
DEBUG
:
log
.
info
(
'[courseware.modules.html_module] filename=
%
s'
%
self
.
filename
)
#return render_to_string(self.filename, {'id': self.item_id})
return
render_to_string
(
self
.
filename
,
{
'id'
:
self
.
item_id
},
namespace
=
'course'
)
...
...
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