From 1d851713a0f945d45cffe37a5055bfd4c6c86787 Mon Sep 17 00:00:00 2001 From: Arjun Singh Date: Wed, 25 Jul 2012 21:36:52 -0400 Subject: [PATCH 01/71] Compiling coffee files in course data directories on startup. --- lms/envs/common.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lms/envs/common.py b/lms/envs/common.py index b1fbbb9bab..c8bfaa35e9 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -429,6 +429,22 @@ PIPELINE_JS = { } } +if os.path.isdir(DATA_DIR): + for course_dir in os.listdir(DATA_DIR): + js_dir = DATA_DIR / course_dir / "js" + if not os.path.isdir(js_dir): + continue + for filename in os.listdir(js_dir): + if filename.endswith('coffee'): + new_filename = os.path.splitext(filename)[0] + ".js" + if os.path.exists(js_dir / new_filename): + coffee_timestamp = os.stat(js_dir / filename).st_mtime + js_timestamp = os.stat(js_dir / new_filename).st_mtime + if coffee_timestamp <= js_timestamp: + continue + os.system("coffee -c %s" % (js_dir / filename)) + print "coffee -c %s" % (js_dir / filename) + PIPELINE_COMPILERS = [ 'pipeline.compilers.sass.SASSCompiler', 'pipeline.compilers.coffee.CoffeeScriptCompiler', From 3002260de53b07b9443c8f7baee645027e958a5c Mon Sep 17 00:00:00 2001 From: Arjun Singh Date: Wed, 25 Jul 2012 21:36:52 -0400 Subject: [PATCH 02/71] Compiling coffee files in course data directories on startup. --- lms/envs/common.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lms/envs/common.py b/lms/envs/common.py index b1fbbb9bab..4c16380b9c 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -429,6 +429,21 @@ PIPELINE_JS = { } } +if os.path.isdir(DATA_DIR): + for course_dir in os.listdir(DATA_DIR): + js_dir = DATA_DIR / course_dir / "js" + if not os.path.isdir(js_dir): + continue + for filename in os.listdir(js_dir): + if filename.endswith('coffee'): + new_filename = os.path.splitext(filename)[0] + ".js" + if os.path.exists(js_dir / new_filename): + coffee_timestamp = os.stat(js_dir / filename).st_mtime + js_timestamp = os.stat(js_dir / new_filename).st_mtime + if coffee_timestamp <= js_timestamp: + continue + os.system("coffee -c %s" % (js_dir / filename)) + PIPELINE_COMPILERS = [ 'pipeline.compilers.sass.SASSCompiler', 'pipeline.compilers.coffee.CoffeeScriptCompiler', From c6d160ad1edac45753e3dc61e238a7def41a526b Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 26 Jul 2012 10:48:55 -0400 Subject: [PATCH 03/71] Ignore some spurious errors from pylint --- .pylintrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index 54e2f5c8a9..ce2f2e3b87 100644 --- a/.pylintrc +++ b/.pylintrc @@ -33,7 +33,7 @@ load-plugins= # can either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). -#disable= +disable=E1102,W0142 [REPORTS] @@ -82,7 +82,7 @@ zope=no # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E0201 when accessed. Python regular # expressions are accepted. -generated-members=REQUEST,acl_users,aq_parent +generated-members=REQUEST,acl_users,aq_parent,objects,DoesNotExist,can_read,can_write,get_url,size [BASIC] From 1d554c76a038841d23c77cdfe5910b89443ecccf Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 26 Jul 2012 12:05:23 -0400 Subject: [PATCH 04/71] Comment out really loud debug messages from xml.py --- common/lib/xmodule/xmodule/modulestore/xml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index b8e86b97f1..3981009cef 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -53,8 +53,9 @@ class XMLModuleStore(ModuleStore): class_ = getattr(import_module(module_path), class_name) self.default_class = class_ - log.debug('XMLModuleStore: eager=%s, data_dir = %s' % (eager, self.data_dir)) - log.debug('default_class = %s' % self.default_class) + # TODO (cpennington): We need a better way of selecting specific sets of debug messages to enable. These were drowning out important messages + #log.debug('XMLModuleStore: eager=%s, data_dir = %s' % (eager, self.data_dir)) + #log.debug('default_class = %s' % self.default_class) for course_dir in os.listdir(self.data_dir): if course_dirs is not None and course_dir not in course_dirs: From 73261719ce7d509a16c9eff9f985fcb704b51dbf Mon Sep 17 00:00:00 2001 From: Arjun Singh Date: Thu, 26 Jul 2012 13:14:00 -0400 Subject: [PATCH 05/71] Added TODO near temporary code. --- lms/envs/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lms/envs/common.py b/lms/envs/common.py index 4c16380b9c..54fb94e7bd 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -429,6 +429,9 @@ PIPELINE_JS = { } } +# Compile all coffee files in course data directories if they are out of date. +# TODO: Remove this once we move data into Mongo. This is only temporary while +# course data directories are still in use. if os.path.isdir(DATA_DIR): for course_dir in os.listdir(DATA_DIR): js_dir = DATA_DIR / course_dir / "js" From 8e2ced916f45d7c517e7305006bf25d6dac1ad63 Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Thu, 26 Jul 2012 14:06:29 -0400 Subject: [PATCH 06/71] Add field-error class to field with issues. --- common/djangoapps/student/views.py | 8 ++++++++ lms/templates/signup_modal.html | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 1644822d5f..6e2cf5b791 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -264,14 +264,17 @@ def create_account(request, post_override=None): for a in ['username', 'email', 'password', 'name']: if a not in post_vars: js['value'] = "Error (401 {field}). E-mail us.".format(field=a) + js['field'] = a return HttpResponse(json.dumps(js)) if post_vars.get('honor_code', 'false') != u'true': js['value'] = "To enroll, you must follow the honor code.".format(field=a) + js['field'] = 'honor_code' return HttpResponse(json.dumps(js)) if post_vars.get('terms_of_service', 'false') != u'true': js['value'] = "You must accept the terms of service.".format(field=a) + js['field'] = 'terms_of_service' return HttpResponse(json.dumps(js)) # Confirm appropriate fields are there. @@ -288,18 +291,21 @@ def create_account(request, post_override=None): 'terms_of_service': 'Accepting Terms of Service is required.', 'honor_code': 'Agreeing to the Honor Code is required.'} js['value'] = error_str[a] + js['field'] = a return HttpResponse(json.dumps(js)) try: validate_email(post_vars['email']) except ValidationError: js['value'] = "Valid e-mail is required.".format(field=a) + js['field'] = 'email' return HttpResponse(json.dumps(js)) try: validate_slug(post_vars['username']) except ValidationError: js['value'] = "Username should only consist of A-Z and 0-9.".format(field=a) + js['field'] = 'username' return HttpResponse(json.dumps(js)) u = User(username=post_vars['username'], @@ -315,10 +321,12 @@ def create_account(request, post_override=None): # Figure out the cause of the integrity error if len(User.objects.filter(username=post_vars['username'])) > 0: js['value'] = "An account with this username already exists." + js['field'] = 'username' return HttpResponse(json.dumps(js)) if len(User.objects.filter(email=post_vars['email'])) > 0: js['value'] = "An account with this e-mail already exists." + js['field'] = 'email' return HttpResponse(json.dumps(js)) raise diff --git a/lms/templates/signup_modal.html b/lms/templates/signup_modal.html index 26b248d0ee..aef90ab0f2 100644 --- a/lms/templates/signup_modal.html +++ b/lms/templates/signup_modal.html @@ -19,19 +19,19 @@
- + - + - + - +
- +
@@ -55,7 +55,7 @@
- +
- +
-