From 22f4004ee9a3a5449651466e03550aaacb9b713c Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Fri, 3 Feb 2012 10:27:02 -0500 Subject: [PATCH 1/3] HTML no longer has answers --- courseware/capa/capa_problem.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/courseware/capa/capa_problem.py b/courseware/capa/capa_problem.py index 032b5d41b4..2ed579d224 100644 --- a/courseware/capa/capa_problem.py +++ b/courseware/capa/capa_problem.py @@ -193,6 +193,12 @@ class LoncapaProblem(object): if problemtree.tag in html_transforms: tree.tag=html_transforms[problemtree.tag]['tag'] + # Reset attributes. Otherwise, we get metadata in HTML + # (e.g. answers) + # TODO: We should remove and not zero them. + # I'm not sure how to do that quickly with lxml + for k in tree.keys(): + tree.set(k,"") # TODO: Fix. This loses Element().tail #if problemtree.tag in html_skip: From eed5d95ddea102fb9366b620236ee53d7e03590c Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Fri, 3 Feb 2012 14:00:06 -0500 Subject: [PATCH 2/3] lower karma threshold for file/image uploads to 1 --- settings_new_askbot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/settings_new_askbot.py b/settings_new_askbot.py index d95c843e09..8c63960b38 100644 --- a/settings_new_askbot.py +++ b/settings_new_askbot.py @@ -328,6 +328,7 @@ LIVESETTINGS_OPTIONS = { 'SETTINGS' : { 'MIN_REP' : { 'MIN_REP_TO_VOTE_UP' : 1, + 'MIN_REP_TO_UPLOAD_FILES' : 1, }, 'SOCIAL_SHARING' : { 'ENABLE_SHARING_TWITTER' : False, From a9e3922047dc5b54f4c673fb910890e7d1f55759 Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Fri, 3 Feb 2012 14:07:23 -0500 Subject: [PATCH 3/3] HTML module looks in html directory in data --- courseware/modules/html_module.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/courseware/modules/html_module.py b/courseware/modules/html_module.py index e72fea9dfd..f1ce14ec7e 100644 --- a/courseware/modules/html_module.py +++ b/courseware/modules/html_module.py @@ -17,13 +17,16 @@ class HtmlModule(XModule): return "html" def get_html(self): - if self.filename!=None: - return render_to_string(self.filename, {'id': self.item_id}) - else: + if self.filename==None: xmltree=etree.fromstring(self.xml) textlist=[xmltree.text]+[etree.tostring(i) for i in xmltree]+[xmltree.tail] textlist=[i for i in textlist if type(i)==str] return "".join(textlist) + try: + filename=settings.DATA_DIR+"html/"+self.filename+".xml" + return open(filename).read() + except: # For backwards compatibility. TODO: Remove + return render_to_string(self.filename, {'id': self.item_id}) 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)