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
6a6b24af
Commit
6a6b24af
authored
Aug 28, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable jsresponse file compilation; done manually for now.
parent
88e48531
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
24 deletions
+81
-24
common/lib/capa/capa/responsetypes.py
+31
-24
common/lib/xmodule/xmodule/tests/test_files/js/compiled/javascriptresponse.js
+50
-0
No files found.
common/lib/capa/capa/responsetypes.py
View file @
6a6b24af
...
...
@@ -318,30 +318,37 @@ class JavascriptResponse(LoncapaResponse):
def
compile_display_javascript
(
self
):
latestTimestamp
=
0
basepath
=
self
.
system
.
filestore
.
root_path
+
'/js/'
for
filename
in
(
self
.
display_dependencies
+
[
self
.
display
]):
filepath
=
basepath
+
filename
timestamp
=
os
.
stat
(
filepath
)
.
st_mtime
if
timestamp
>
latestTimestamp
:
latestTimestamp
=
timestamp
h
=
hashlib
.
md5
()
h
.
update
(
self
.
answer_id
+
str
(
self
.
display_dependencies
))
compiled_filename
=
'compiled/'
+
h
.
hexdigest
()
+
'.js'
compiled_filepath
=
basepath
+
compiled_filename
if
not
os
.
path
.
exists
(
compiled_filepath
)
or
os
.
stat
(
compiled_filepath
)
.
st_mtime
<
latestTimestamp
:
outfile
=
open
(
compiled_filepath
,
'w'
)
for
filename
in
(
self
.
display_dependencies
+
[
self
.
display
]):
filepath
=
basepath
+
filename
infile
=
open
(
filepath
,
'r'
)
outfile
.
write
(
infile
.
read
())
outfile
.
write
(
';
\n
'
)
infile
.
close
()
outfile
.
close
()
self
.
display_filename
=
compiled_filename
# TODO FIXME
# arjun: removing this behavior for now (and likely forever). Keeping
# until we decide on exactly how to solve this issue. For now, files are
# manually being compiled to DATA_DIR/js/compiled.
#latestTimestamp = 0
#basepath = self.system.filestore.root_path + '/js/'
#for filename in (self.display_dependencies + [self.display]):
# filepath = basepath + filename
# timestamp = os.stat(filepath).st_mtime
# if timestamp > latestTimestamp:
# latestTimestamp = timestamp
#
#h = hashlib.md5()
#h.update(self.answer_id + str(self.display_dependencies))
#compiled_filename = 'compiled/' + h.hexdigest() + '.js'
#compiled_filepath = basepath + compiled_filename
#if not os.path.exists(compiled_filepath) or os.stat(compiled_filepath).st_mtime < latestTimestamp:
# outfile = open(compiled_filepath, 'w')
# for filename in (self.display_dependencies + [self.display]):
# filepath = basepath + filename
# infile = open(filepath, 'r')
# outfile.write(infile.read())
# outfile.write(';\n')
# infile.close()
# outfile.close()
# TODO this should also be fixed when the above is fixed.
filename
=
self
.
system
.
ajax_url
.
split
(
'/'
)[
-
1
]
+
'.js'
self
.
display_filename
=
'compiled/'
+
filename
def
parse_xml
(
self
):
self
.
generator_xml
=
self
.
xml
.
xpath
(
'//*[@id=$id]//generator'
,
...
...
common/lib/xmodule/xmodule/tests/test_files/js/compiled/javascriptresponse.js
0 → 100644
View file @
6a6b24af
// Generated by CoffeeScript 1.3.3
(
function
()
{
var
MinimaxProblemDisplay
,
root
,
__hasProp
=
{}.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
MinimaxProblemDisplay
=
(
function
(
_super
)
{
__extends
(
MinimaxProblemDisplay
,
_super
);
function
MinimaxProblemDisplay
(
state
,
submission
,
evaluation
,
container
,
submissionField
,
parameters
)
{
this
.
state
=
state
;
this
.
submission
=
submission
;
this
.
evaluation
=
evaluation
;
this
.
container
=
container
;
this
.
submissionField
=
submissionField
;
this
.
parameters
=
parameters
!=
null
?
parameters
:
{};
MinimaxProblemDisplay
.
__super__
.
constructor
.
call
(
this
,
this
.
state
,
this
.
submission
,
this
.
evaluation
,
this
.
container
,
this
.
submissionField
,
this
.
parameters
);
}
MinimaxProblemDisplay
.
prototype
.
render
=
function
()
{};
MinimaxProblemDisplay
.
prototype
.
createSubmission
=
function
()
{
var
id
,
value
,
_ref
,
_results
;
this
.
newSubmission
=
{};
if
(
this
.
submission
!=
null
)
{
_ref
=
this
.
submission
;
_results
=
[];
for
(
id
in
_ref
)
{
value
=
_ref
[
id
];
_results
.
push
(
this
.
newSubmission
[
id
]
=
value
);
}
return
_results
;
}
};
MinimaxProblemDisplay
.
prototype
.
getCurrentSubmission
=
function
()
{
return
this
.
newSubmission
;
};
return
MinimaxProblemDisplay
;
})(
XProblemDisplay
);
root
=
typeof
exports
!==
"undefined"
&&
exports
!==
null
?
exports
:
this
;
root
.
TestProblemDisplay
=
TestProblemDisplay
;
}).
call
(
this
);
;
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