forked from DMOJ/online-judge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ANSI HTML-ifying to site; DMOJ/judge-server#478
- Loading branch information
1 parent
e3139e3
commit 0a0a0db
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import lxml.html as lh | ||
from lxml.html.clean import clean_html | ||
|
||
|
||
def strip_error_html(apps, schema_editor): | ||
Submission = apps.get_model('judge', 'Submission') | ||
for sub in Submission.objects.filter(error__isnull=False): | ||
sub.error = clean_html(lh.fromstring(sub.error)).text_content() | ||
sub.save(update_fields=['error']) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('judge', '0087_problem_resource_limits'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(strip_error_html, migrations.RunPython.noop), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ jsonfield | |
pymoss | ||
packaging | ||
celery | ||
ansi2html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters