Merge pull request #582 from MITx/feature/arjun/jsresponse_compilation
Disable jsresponse file compilation; done manually for now.
This commit is contained in:
@@ -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
|
||||
# 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.
|
||||
|
||||
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()
|
||||
#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
|
||||
|
||||
self.display_filename = 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',
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// 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);
|
||||
;
|
||||
Reference in New Issue
Block a user