Commit 65dd3cc9 by Steve Strassmann

pull from master

parents c0278d0f 5e288b60
...@@ -6,7 +6,7 @@ from . import one_time_startup ...@@ -6,7 +6,7 @@ from . import one_time_startup
# from django.contrib import admin # from django.contrib import admin
# admin.autodiscover() # admin.autodiscover()
urlpatterns = ('', urlpatterns = ('', # nopep8
url(r'^$', 'contentstore.views.howitworks', name='homepage'), url(r'^$', 'contentstore.views.howitworks', name='homepage'),
url(r'^listing', 'contentstore.views.index', name='index'), url(r'^listing', 'contentstore.views.index', name='index'),
url(r'^edit/(?P<location>.*?)$', 'contentstore.views.edit_unit', name='edit_unit'), url(r'^edit/(?P<location>.*?)$', 'contentstore.views.edit_unit', name='edit_unit'),
...@@ -118,17 +118,17 @@ urlpatterns += ( ...@@ -118,17 +118,17 @@ urlpatterns += (
# static/proof-of-concept views # static/proof-of-concept views
url(r'^ux-alerts$', 'contentstore.views.ux_alerts', name='ux-alerts') url(r'^ux-alerts$', 'contentstore.views.ux_alerts', name='ux-alerts')
) )
js_info_dict = { js_info_dict = {
'domain': 'djangojs', 'domain': 'djangojs',
'packages': ('cms',), 'packages': ('cms',),
} }
urlpatterns += ( urlpatterns += (
# Serve catalog of localized strings to be rendered by Javascript # Serve catalog of localized strings to be rendered by Javascript
url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
) )
if settings.ENABLE_JASMINE: if settings.ENABLE_JASMINE:
...@@ -140,5 +140,3 @@ urlpatterns = patterns(*urlpatterns) ...@@ -140,5 +140,3 @@ urlpatterns = patterns(*urlpatterns)
# Custom error pages # Custom error pages
handler404 = 'contentstore.views.render_404' handler404 = 'contentstore.views.render_404'
handler500 = 'contentstore.views.render_500' handler500 = 'contentstore.views.render_500'
from django.conf.urls import * from django.conf.urls import *
urlpatterns = patterns('', urlpatterns = patterns('', # nopep8
url(r'^$', 'heartbeat.views.heartbeat', name='heartbeat'), url(r'^$', 'heartbeat.views.heartbeat', name='heartbeat'),
) )
...@@ -1147,9 +1147,9 @@ def sympy_check2(): ...@@ -1147,9 +1147,9 @@ def sympy_check2():
messages = [] messages = []
for input_dict in input_list: for input_dict in input_list:
correct.append('correct' correct.append('correct'
if input_dict['ok'] else 'incorrect') if input_dict['ok'] else 'incorrect')
msg = (self.clean_message_html(input_dict['msg']) msg = (self.clean_message_html(input_dict['msg'])
if 'msg' in input_dict else None) if 'msg' in input_dict else None)
messages.append(msg) messages.append(msg)
# Otherwise, we do not recognize the dictionary # Otherwise, we do not recognize the dictionary
...@@ -1174,7 +1174,7 @@ def sympy_check2(): ...@@ -1174,7 +1174,7 @@ def sympy_check2():
for k in range(len(idset)): for k in range(len(idset)):
npoints = (self.maxpoints[idset[k]] npoints = (self.maxpoints[idset[k]]
if correct[k] == 'correct' else 0) if correct[k] == 'correct' else 0)
correct_map.set(idset[k], correct[k], msg=messages[k], correct_map.set(idset[k], correct[k], msg=messages[k],
npoints=npoints) npoints=npoints)
return correct_map return correct_map
...@@ -1851,6 +1851,19 @@ class FormulaResponse(LoncapaResponse): ...@@ -1851,6 +1851,19 @@ class FormulaResponse(LoncapaResponse):
'formularesponse: undefined variable in given=%s' % given) 'formularesponse: undefined variable in given=%s' % given)
raise StudentInputError( raise StudentInputError(
"Invalid input: " + uv.message + " not permitted in answer") "Invalid input: " + uv.message + " not permitted in answer")
except ValueError as ve:
if 'factorial' in ve.message:
# This is thrown when fact() or factorial() is used in a formularesponse answer
# that tests on negative and/or non-integer inputs
# ve.message will be: `factorial() only accepts integral values` or `factorial() not defined for negative values`
log.debug(
'formularesponse: factorial function used in response that tests negative and/or non-integer inputs. given={0}'.format(given))
raise StudentInputError(
"factorial function not permitted in answer for this problem. Provided answer was: {0}".format(given))
# If non-factorial related ValueError thrown, handle it the same as any other Exception
log.debug('formularesponse: error {0} in formula'.format(ve))
raise StudentInputError("Invalid input: Could not parse '%s' as a formula" %
cgi.escape(given))
except Exception as err: except Exception as err:
# traceback.print_exc() # traceback.print_exc()
log.debug('formularesponse: error %s in formula' % err) log.debug('formularesponse: error %s in formula' % err)
...@@ -1983,7 +1996,6 @@ class ImageResponse(LoncapaResponse): ...@@ -1983,7 +1996,6 @@ class ImageResponse(LoncapaResponse):
self.ielements = self.inputfields self.ielements = self.inputfields
self.answer_ids = [ie.get('id') for ie in self.ielements] self.answer_ids = [ie.get('id') for ie in self.ielements]
def get_score(self, student_answers): def get_score(self, student_answers):
correct_map = CorrectMap() correct_map = CorrectMap()
expectedset = self.get_mapped_answers() expectedset = self.get_mapped_answers()
...@@ -2052,7 +2064,7 @@ class ImageResponse(LoncapaResponse): ...@@ -2052,7 +2064,7 @@ class ImageResponse(LoncapaResponse):
rectangles (dict) - a map of inputs to the defined rectangle for that input rectangles (dict) - a map of inputs to the defined rectangle for that input
regions (dict) - a map of inputs to the defined region for that input regions (dict) - a map of inputs to the defined region for that input
''' '''
answers = ( answers = (
dict([(ie.get('id'), ie.get( dict([(ie.get('id'), ie.get(
'rectangle')) for ie in self.ielements]), 'rectangle')) for ie in self.ielements]),
dict([(ie.get('id'), ie.get('regions')) for ie in self.ielements])) dict([(ie.get('id'), ie.get('regions')) for ie in self.ielements]))
...@@ -2074,8 +2086,6 @@ class ImageResponse(LoncapaResponse): ...@@ -2074,8 +2086,6 @@ class ImageResponse(LoncapaResponse):
answers[ie_id] = (ie.get('rectangle'), ie.get('regions')) answers[ie_id] = (ie.get('rectangle'), ie.get('regions'))
return answers return answers
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
......
from django.conf.urls.defaults import url, patterns from django.conf.urls.defaults import url, patterns
import django_comment_client.base.views
urlpatterns = patterns('django_comment_client.base.views',
urlpatterns = patterns('django_comment_client.base.views', # nopep8
url(r'upload$', 'upload', name='upload'), url(r'upload$', 'upload', name='upload'),
url(r'users/(?P<user_id>\w+)/update_moderator_status$', 'update_moderator_status', name='update_moderator_status'), url(r'users/(?P<user_id>\w+)/update_moderator_status$', 'update_moderator_status', name='update_moderator_status'),
url(r'threads/tags/autocomplete$', 'tags_autocomplete', name='tags_autocomplete'), url(r'threads/tags/autocomplete$', 'tags_autocomplete', name='tags_autocomplete'),
......
from django.conf.urls.defaults import url, patterns from django.conf.urls.defaults import url, patterns
import django_comment_client.forum.views
urlpatterns = patterns('django_comment_client.forum.views', urlpatterns = patterns('django_comment_client.forum.views', # nopep8
url(r'users/(?P<user_id>\w+)/followed$', 'followed_threads', name='followed_threads'), url(r'users/(?P<user_id>\w+)/followed$', 'followed_threads', name='followed_threads'),
url(r'users/(?P<user_id>\w+)$', 'user_profile', name='user_profile'), url(r'users/(?P<user_id>\w+)$', 'user_profile', name='user_profile'),
url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'), url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', 'single_thread', name='single_thread'),
......
from django.conf.urls.defaults import url, patterns, include from django.conf.urls.defaults import url, patterns, include
urlpatterns = patterns('', urlpatterns = patterns('', # nopep8
url(r'forum/?', include('django_comment_client.forum.urls')), url(r'forum/?', include('django_comment_client.forum.urls')),
url(r'', include('django_comment_client.base.urls')), url(r'', include('django_comment_client.base.urls')),
) )
...@@ -4,16 +4,16 @@ namespace_regex = r"[a-zA-Z\d._-]+" ...@@ -4,16 +4,16 @@ namespace_regex = r"[a-zA-Z\d._-]+"
article_slug = r'/(?P<article_path>' + namespace_regex + r'/[a-zA-Z\d_-]*)' article_slug = r'/(?P<article_path>' + namespace_regex + r'/[a-zA-Z\d_-]*)'
namespace = r'/(?P<namespace>' + namespace_regex + r')' namespace = r'/(?P<namespace>' + namespace_regex + r')'
urlpatterns = patterns('', urlpatterns = patterns('', # nopep8
url(r'^$', 'simplewiki.views.root_redirect', name='wiki_root'), url(r'^$', 'simplewiki.views.root_redirect', name='wiki_root'),
url(r'^view' + article_slug, 'simplewiki.views.view', name='wiki_view'), url(r'^view' + article_slug, 'simplewiki.views.view', name='wiki_view'),
url(r'^view_revision/(?P<revision_number>[0-9]+)' + article_slug, 'simplewiki.views.view_revision', name='wiki_view_revision'), url(r'^view_revision/(?P<revision_number>[0-9]+)' + article_slug, 'simplewiki.views.view_revision', name='wiki_view_revision'),
url(r'^edit' + article_slug, 'simplewiki.views.edit', name='wiki_edit'), url(r'^edit' + article_slug, 'simplewiki.views.edit', name='wiki_edit'),
url(r'^create' + article_slug, 'simplewiki.views.create', name='wiki_create'), url(r'^create' + article_slug, 'simplewiki.views.create', name='wiki_create'),
url(r'^history' + article_slug + r'(?:/(?P<page>[0-9]+))?$', 'simplewiki.views.history', name='wiki_history'), url(r'^history' + article_slug + r'(?:/(?P<page>[0-9]+))?$', 'simplewiki.views.history', name='wiki_history'),
url(r'^search_related' + article_slug, 'simplewiki.views.search_add_related', name='search_related'), url(r'^search_related' + article_slug, 'simplewiki.views.search_add_related', name='search_related'),
url(r'^random/?$', 'simplewiki.views.random_article', name='wiki_random'), url(r'^random/?$', 'simplewiki.views.random_article', name='wiki_random'),
url(r'^revision_feed' + namespace + r'/(?P<page>[0-9]+)?$', 'simplewiki.views.revision_feed', name='wiki_revision_feed'), url(r'^revision_feed' + namespace + r'/(?P<page>[0-9]+)?$', 'simplewiki.views.revision_feed', name='wiki_revision_feed'),
url(r'^search' + namespace + r'?$', 'simplewiki.views.search_articles', name='wiki_search_articles'), url(r'^search' + namespace + r'?$', 'simplewiki.views.search_articles', name='wiki_search_articles'),
url(r'^list' + namespace + r'?$', 'simplewiki.views.search_articles', name='wiki_list_articles'), # Just an alias for the search, but you usually don't submit a search term url(r'^list' + namespace + r'?$', 'simplewiki.views.search_articles', name='wiki_list_articles'), # Just an alias for the search, but you usually don't submit a search term
) )
...@@ -2,7 +2,6 @@ from django.conf import settings ...@@ -2,7 +2,6 @@ from django.conf import settings
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.contrib import admin from django.contrib import admin
from django.conf.urls.static import static from django.conf.urls.static import static
from django.views.generic import RedirectView
from . import one_time_startup from . import one_time_startup
...@@ -10,10 +9,9 @@ import django.contrib.auth.views ...@@ -10,10 +9,9 @@ import django.contrib.auth.views
# Uncomment the next two lines to enable the admin: # Uncomment the next two lines to enable the admin:
if settings.DEBUG: if settings.DEBUG:
from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = ('', urlpatterns = ('', # nopep8
# certificate view # certificate view
url(r'^update_certificate$', 'certificates.views.update_certificate'), url(r'^update_certificate$', 'certificates.views.update_certificate'),
...@@ -299,12 +297,12 @@ if settings.COURSEWARE_ENABLED: ...@@ -299,12 +297,12 @@ if settings.COURSEWARE_ENABLED:
'courseware.views.news', name="news"), 'courseware.views.news', name="news"),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/discussion/', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/discussion/',
include('django_comment_client.urls')) include('django_comment_client.urls'))
) )
urlpatterns += ( urlpatterns += (
# This MUST be the last view in the courseware--it's a catch-all for custom tabs. # This MUST be the last view in the courseware--it's a catch-all for custom tabs.
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/(?P<tab_slug>[^/]+)/$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/(?P<tab_slug>[^/]+)/$',
'courseware.views.static_tab', name="static_tab"), 'courseware.views.static_tab', name="static_tab"),
) )
if settings.MITX_FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW'): if settings.MITX_FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW'):
urlpatterns += ( urlpatterns += (
...@@ -346,13 +344,13 @@ if settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION'): ...@@ -346,13 +344,13 @@ if settings.MITX_FEATURES.get('ENABLE_LMS_MIGRATION'):
url(r'^migrate/reload/(?P<reload_dir>[^/]+)/(?P<commit_id>[^/]+)$', 'lms_migration.migrate.manage_modulestores'), url(r'^migrate/reload/(?P<reload_dir>[^/]+)/(?P<commit_id>[^/]+)$', 'lms_migration.migrate.manage_modulestores'),
url(r'^gitreload$', 'lms_migration.migrate.gitreload'), url(r'^gitreload$', 'lms_migration.migrate.gitreload'),
url(r'^gitreload/(?P<reload_dir>[^/]+)$', 'lms_migration.migrate.gitreload'), url(r'^gitreload/(?P<reload_dir>[^/]+)$', 'lms_migration.migrate.gitreload'),
) )
if settings.MITX_FEATURES.get('ENABLE_SQL_TRACKING_LOGS'): if settings.MITX_FEATURES.get('ENABLE_SQL_TRACKING_LOGS'):
urlpatterns += ( urlpatterns += (
url(r'^event_logs$', 'track.views.view_tracking_log'), url(r'^event_logs$', 'track.views.view_tracking_log'),
url(r'^event_logs/(?P<args>.+)$', 'track.views.view_tracking_log'), url(r'^event_logs/(?P<args>.+)$', 'track.views.view_tracking_log'),
) )
# FoldIt views # FoldIt views
urlpatterns += ( urlpatterns += (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment