Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc/2013 09 04 #857

Merged
merged 23 commits into from
Sep 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6738a37
Keep comments in capa XML from causing failures
nedbat Aug 27, 2013
e88e04d
A test that our XML-comments fix works.
nedbat Aug 27, 2013
6cb2e0b
Check extension rather than mimetype
Aug 28, 2013
fbb6dc0
Merge pull request #819 from edx/jkarni/hotfix/gzip-mimetype
Aug 28, 2013
14708aa
Merge pull request #816 from edx/hotfix/xml-parsing
adampalay Aug 28, 2013
1f2f0bf
Skip acceptance test DB migrations if the DB already exists and runni…
Aug 29, 2013
1ab59a2
add pyparsing explicitly to sandbox requirements
adampalay Sep 3, 2013
a7159d8
add pyparsing to edx requirements
adampalay Sep 3, 2013
e94515d
Fix for acceptance test static file issue
Sep 3, 2013
a09e610
Fix multiple video bug
polesye Aug 30, 2013
a081746
Merge pull request #849 from edx/will/acceptance-test-static-files
Sep 3, 2013
c7a537e
Merge pull request #848 from edx/fix/adam/add-edge-reqs
adampalay Sep 3, 2013
300f7f1
fix pep8 and pylint errors
adampalay Sep 3, 2013
e284ac6
Merge pull request #837 from edx/will/faster-acceptance-test-startup
Sep 3, 2013
6787fbb
Merge pull request #851 from edx/hotfix/release-multiple-video-bug
adampalay Sep 3, 2013
67890b3
resolve merge conflict with hotfix branch
adampalay Sep 3, 2013
3cc793b
Merge pull request #856 from edx/adam/merge-conflicts
adampalay Sep 3, 2013
ef042c3
Merge pull request #853 from edx/fix/adam/pylint-pep8
adampalay Sep 3, 2013
51fcb52
Merge pull request #855 from edx/sarina/bulkemail-violations
sarina Sep 3, 2013
b2b23fa
Pass in harvest args to fasttest_acceptance, not the args array
wedaly Sep 4, 2013
fb84541
add nltk to sandbox reqs
adampalay Sep 4, 2013
961bd4c
Fix selector.
polesye Sep 5, 2013
5d55714
Fix test.
polesye Sep 5, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ def _get_discussion_items(module):
for item in queried_discussion_items:
if item.location.url() not in discussion_items:
print 'Found dangling discussion module = {0}'.format(item.location.url())

85 changes: 46 additions & 39 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,33 @@ def create_new_course(request):
pass
if existing_course is not None:
return JsonResponse({
'ErrMsg': _('There is already a course defined with the same '
'organization, course number, and course run. Please '
'change either organization or course number to be '
'unique.'),
'OrgErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
'CourseErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
'ErrMsg': _('There is already a course defined with the same '
'organization, course number, and course run. Please '
'change either organization or course number to be '
'unique.'),
'OrgErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
'CourseErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
})

course_search_location = ['i4x', dest_location.org, dest_location.course,
'course', None
course_search_location = [
'i4x',
dest_location.org,
dest_location.course,
'course',
None
]
courses = modulestore().get_items(course_search_location)
if len(courses) > 0:
return JsonResponse({
'ErrMsg': _('There is already a course defined with the same '
'organization and course number. Please '
'change at least one field to be unique.'),
'OrgErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
'CourseErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
'ErrMsg': _('There is already a course defined with the same '
'organization and course number. Please '
'change at least one field to be unique.'),
'OrgErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
'CourseErrMsg': _('Please change either the organization or '
'course number so that it is unique.'),
})

# instantiate the CourseDescriptor and then persist it
Expand All @@ -156,15 +160,15 @@ def create_new_course(request):
else:
metadata = {'display_name': display_name}
modulestore('direct').create_and_save_xmodule(
dest_location,
metadata=metadata
dest_location,
metadata=metadata
)
new_course = modulestore('direct').get_item(dest_location)

# clone a default 'about' overview module as well
dest_about_location = dest_location.replace(
category='about',
name='overview'
category='about',
name='overview'
)
overview_template = AboutDescriptor.get_template('overview.yaml')
modulestore('direct').create_and_save_xmodule(
Expand Down Expand Up @@ -203,13 +207,16 @@ def course_info(request, org, course, name, provided_id=None):
# get current updates
location = Location(['i4x', org, course, 'course_info', "updates"])

return render_to_response('course_info.html', {
'context_course': course_module,
'url_base': "/" + org + "/" + course + "/",
'course_updates': json.dumps(get_course_updates(location)),
'handouts_location': Location(['i4x', org, course, 'course_info', 'handouts']).url(),
'base_asset_url': StaticContent.get_base_url_path_for_course_assets(location) + '/'})

return render_to_response(
'course_info.html',
{
'context_course': course_module,
'url_base': "/" + org + "/" + course + "/",
'course_updates': json.dumps(get_course_updates(location)),
'handouts_location': Location(['i4x', org, course, 'course_info', 'handouts']).url(),
'base_asset_url': StaticContent.get_base_url_path_for_course_assets(location) + '/'
}
)

@expect_json
@require_http_methods(("GET", "POST", "PUT", "DELETE"))
Expand Down Expand Up @@ -245,7 +252,7 @@ def course_info_updates(request, org, course, provided_id=None):
content_type="text/plain"
)
# can be either and sometimes django is rewriting one to the other:
elif request.method in ('POST', 'PUT'):
elif request.method in ('POST', 'PUT'):
try:
return JsonResponse(update_course_updates(location, request.POST, provided_id))
except:
Expand Down Expand Up @@ -380,16 +387,16 @@ def course_grader_updates(request, org, course, name, grader_index=None):
if request.method == 'GET':
# Cannot just do a get w/o knowing the course name :-(
return JsonResponse(CourseGradingModel.fetch_grader(
Location(location), grader_index
Location(location), grader_index
))
elif request.method == "DELETE":
# ??? Should this return anything? Perhaps success fail?
CourseGradingModel.delete_grader(Location(location), grader_index)
return JsonResponse()
else: # post or put, doesn't matter.
return JsonResponse(CourseGradingModel.update_grader_from_json(
Location(location),
request.POST
Location(location),
request.POST
))


Expand All @@ -411,8 +418,8 @@ def course_advanced_updates(request, org, course, name):
return JsonResponse(CourseMetadata.fetch(location))
elif request.method == 'DELETE':
return JsonResponse(CourseMetadata.delete_key(
location,
json.loads(request.body)
location,
json.loads(request.body)
))
else:
# NOTE: request.POST is messed up because expect_json
Expand Down Expand Up @@ -479,9 +486,9 @@ def course_advanced_updates(request, org, course, name):
filter_tabs = False
try:
return JsonResponse(CourseMetadata.update_from_json(
location,
request_body,
filter_tabs=filter_tabs
location,
request_body,
filter_tabs=filter_tabs
))
except (TypeError, ValueError) as err:
return HttpResponseBadRequest(
Expand Down Expand Up @@ -585,8 +592,8 @@ def textbook_index(request, org, course, name):
# MongoKeyValueStore before we update the mongo datastore.
course_module.save()
store.update_metadata(
course_module.location,
own_metadata(course_module)
course_module.location,
own_metadata(course_module)
)
return JsonResponse(course_module.pdf_textbooks)
else:
Expand Down
4 changes: 2 additions & 2 deletions cms/envs/acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def seed():
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': TEST_ROOT / "db" / "test_mitx_%s.db" % seed(),
'TEST_NAME': TEST_ROOT / "db" / "test_mitx_%s.db" % seed(),
'NAME': TEST_ROOT / "db" / "test_edx.db",
'TEST_NAME': TEST_ROOT / "db" / "test_edx.db"
}
}

Expand Down
77 changes: 0 additions & 77 deletions cms/envs/acceptance_static.py

This file was deleted.

2 changes: 1 addition & 1 deletion cms/templates/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h2>${_("Course to import:")}</h2>
add: function(e, data) {
submitBtn.unbind('click');
var file = data.files[0];
if (file.type == "application/x-gzip") {
if (file.name.match(/tar\.gz$/)) {
submitBtn.click(function(e){
e.preventDefault();
submitBtn.hide();
Expand Down
2 changes: 2 additions & 0 deletions common/djangoapps/terrain/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
# to use staticfiles.
try:
import staticfiles
import staticfiles.handlers
except ImportError:
pass
else:
import sys
sys.modules['django.contrib.staticfiles'] = staticfiles
sys.modules['django.contrib.staticfiles.handlers'] = staticfiles.handlers

LOGGER = getLogger(__name__)
LOGGER.info("Loading the lettuce acceptance testing terrain file...")
Expand Down
57 changes: 30 additions & 27 deletions common/lib/capa/capa/inputtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ def process_requirements(self):
# end up in a partially-initialized state.
loaded = {}
to_render = set()
for a in self.get_attributes():
loaded[a.name] = a.parse_from_xml(self.xml)
if a.render:
to_render.add(a.name)
for attribute in self.get_attributes():
loaded[attribute.name] = attribute.parse_from_xml(self.xml)
if attribute.render:
to_render.add(attribute.name)

self.loaded_attributes = loaded
self.to_render = to_render
Expand Down Expand Up @@ -493,17 +493,17 @@ def get_attributes(cls):
"""
Register the attributes.
"""
return [Attribute('params', None), # extra iframe params
Attribute('html_file', None),
Attribute('gradefn', "gradefn"),
Attribute('get_statefn', None), # Function to call in iframe
# to get current state.
Attribute('set_statefn', None), # Function to call iframe to
# set state
Attribute('width', "400"), # iframe width
Attribute('height', "300")] # iframe height


return [
Attribute('params', None), # extra iframe params
Attribute('html_file', None),
Attribute('gradefn', "gradefn"),
Attribute('get_statefn', None), # Function to call in iframe
# to get current state.
Attribute('set_statefn', None), # Function to call iframe to
# set state
Attribute('width', "400"), # iframe width
Attribute('height', "300") # iframe height
]

def _extra_context(self):
context = {
Expand All @@ -514,7 +514,6 @@ def _extra_context(self):
return context



registry.register(JSInput)
#-----------------------------------------------------------------------------

Expand Down Expand Up @@ -1048,8 +1047,8 @@ def preview_chemcalc(self, data):

try:
result['preview'] = chemcalc.render_to_html(formula)
except pyparsing.ParseException as p:
result['error'] = u"Couldn't parse formula: {0}".format(p.msg)
except pyparsing.ParseException as err:
result['error'] = u"Couldn't parse formula: {0}".format(err.msg)
except Exception:
# this is unexpected, so log
log.warning(
Expand Down Expand Up @@ -1189,15 +1188,19 @@ def parse(tag, tag_type):
'can_reuse': smth}.
"""
tag_attrs = dict()
tag_attrs['draggable'] = {'id': Attribute._sentinel,
'label': "", 'icon': "",
'can_reuse': ""}

tag_attrs['target'] = {'id': Attribute._sentinel,
'x': Attribute._sentinel,
'y': Attribute._sentinel,
'w': Attribute._sentinel,
'h': Attribute._sentinel}
tag_attrs['draggable'] = {
'id': Attribute._sentinel,
'label': "", 'icon': "",
'can_reuse': ""
}

tag_attrs['target'] = {
'id': Attribute._sentinel,
'x': Attribute._sentinel,
'y': Attribute._sentinel,
'w': Attribute._sentinel,
'h': Attribute._sentinel
}

dic = dict()

Expand Down
Loading