Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
relate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
relate
Commits
b6b7636f
Commit
b6b7636f
authored
10 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Allow building stand-alone validation script
parent
73f69a46
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
build-validator-pyz.sh
+42
-0
42 additions, 0 deletions
build-validator-pyz.sh
course/content.py
+12
-6
12 additions, 6 deletions
course/content.py
course/page/text.py
+6
-0
6 additions, 0 deletions
course/page/text.py
with
62 additions
and
6 deletions
.gitignore
+
2
−
0
View file @
b6b7636f
...
...
@@ -11,3 +11,5 @@ components
*.egg-info
build
*.pyz
This diff is collapsed.
Click to expand it.
build-validator-pyz.sh
0 → 100755
+
42
−
0
View file @
b6b7636f
#! /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
This diff is collapsed.
Click to expand it.
course/content.py
+
12
−
6
View file @
b6b7636f
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
course/page/text.py
+
6
−
0
View file @
b6b7636f
...
...
@@ -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
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment