Skip to content
Snippets Groups Projects
Commit b6b7636f authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Allow building stand-alone validation script

parent 73f69a46
No related branches found
No related tags found
No related merge requests found
......@@ -11,3 +11,5 @@ components
*.egg-info
build
*.pyz
#! /bin/bash
set -e
rm -Rf pyz-build
mkdir pyz-build
function pywhichmod()
{
python -c "import $1; import os.path; print($1.__file__.replace('pyc', 'py'))"
}
function pywhichpkg()
{
python -c "import $1; import os.path; print(os.path.dirname($1.__file__))"
}
pyzzer.pyz course relate -r \
$(pywhichmod six) \
$(pywhichpkg markdown) \
$(pywhichpkg django) \
$(pywhichpkg yaml) \
-s '#! /usr/bin/env python2.7' \
-o relate-validate.pyz \
-x migrations \
-x templates \
-x 'static/' \
-x '\..*\.sw[op]' \
-x 'django/db' \
-x 'django/contrib' \
-x 'django/core/management' \
-x 'django/conf/locale' \
-x 'django/test' \
-x 'django/template' \
-x 'django/middleware' \
-x 'django/views' \
-x 'django/http' \
-x 'django/core/serial' \
-x 'django/core/mail' \
-x '_doctest' \
-x '.*~' \
-m course.validation:validate_course_on_filesystem_script_entrypoint
......@@ -32,7 +32,6 @@ import six
from django.utils.timezone import now
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.db import transaction
from markdown.extensions import Extension
from markdown.treeprocessors import Treeprocessor
......@@ -730,15 +729,14 @@ def instantiate_flow_page(location, repo, page_desc, commit_sha):
return class_(None, location, page_desc)
@transaction.atomic
def adjust_flow_session_page_data(repo, flow_session,
def _adjust_flow_session_page_data_inner(repo, flow_session,
course_identifier, flow_desc, commit_sha):
from course.models import FlowPageData
id_to_existing_page = {
(data.group_id, data.page_id): data
id_to_existing_page = dict(
((data.group_id, data.page_id), data)
for data in FlowPageData.objects.filter(flow_session=flow_session)
}
)
data = None
......@@ -779,6 +777,14 @@ def adjust_flow_session_page_data(repo, flow_session,
flow_session.save()
def adjust_flow_session_page_data(repo, flow_session,
course_identifier, flow_desc, commit_sha):
from django.db import transaction
with transaction.atomic():
return _adjust_flow_session_page_data_inner(
repo, flow_session, course_identifier, flow_desc, commit_sha)
def get_course_commit_sha(course, participation):
sha = course.active_git_commit_sha
......
......@@ -286,6 +286,12 @@ class SymbolicExpressionMatcher(TextAnswerMatcher):
try:
self.pattern_sym = parse_sympy(pattern)
except ImportError:
tp, e, _ = sys.exc_info()
vctx.add_warning(location, "%s: unable to check "
"symbolic expression (%s: %s)"
% (location, tp.__name__, str(e)))
except:
tp, e, _ = sys.exc_info()
raise ValidationError("%s: %s: %s"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment