Skip to content

Commit

Permalink
Merge pull request #1677 from dchiller/turn-off-text-validation
Browse files Browse the repository at this point in the history
Temporarily turn off text validation
  • Loading branch information
dchiller authored Oct 22, 2024
2 parents 02d5b0f + e642b63 commit 56f3aab
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
26 changes: 14 additions & 12 deletions django/cantusdb_project/main_app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ class CantusDBLatinField(forms.CharField):

def validate(self, value):
super().validate(value)
if value:
try:
syllabify_text(value)
except LatinError as err:
raise forms.ValidationError(str(err))
except ValueError as exc:
raise forms.ValidationError("Invalid characters in text.") from exc
# Temporarily turn off validation; see #1674
# if value:
# try:
# syllabify_text(value)
# except LatinError as err:
# raise forms.ValidationError(str(err))
# except ValueError as exc:
# raise forms.ValidationError("Invalid characters in text.") from exc


class CantusDBSyllabifiedLatinField(forms.CharField):
Expand All @@ -107,11 +108,12 @@ class CantusDBSyllabifiedLatinField(forms.CharField):

def validate(self, value):
super().validate(value)
if value:
try:
syllabify_text(value, text_presyllabified=True)
except ValueError as exc:
raise forms.ValidationError("Invalid characters in text.") from exc
# Temporarily turn off validation; see #1674
# if value:
# try:
# syllabify_text(value, text_presyllabified=True)
# except ValueError as exc:
# raise forms.ValidationError("Invalid characters in text.") from exc


class StyledChoiceField(forms.ChoiceField):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ <h3>Create Chant</h3>
{% block lowersidebar %}
<div class="card w-100 mb-3">
<div class="card-header">
<h5><a id="source" href="{% url 'source-detail' source.id %}">{{ source.siglum }}</a></h5>
<h5><a id="source" href="{% url 'source-detail' source.id %}">{{ source.short_heading }}</a></h5>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ <h3>
{% block lowersidebar %}
<div class="card mb-3 w-100">
<div class="card-header">
<h4>{{ source.siglum }}</h4>
<h4>{{ source.short_heading }}</h4>
</div>
<div class="card-body">
<small>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from unittest.mock import patch
from unittest import skip
import random
from typing import ClassVar

Expand Down Expand Up @@ -322,6 +323,7 @@ def test_proofread_chant(self):
chant.refresh_from_db()
self.assertIs(chant.manuscript_full_text_std_proofread, True)

@skip("Temporarily disabled due to #1674")
def test_invalid_text(self) -> None:
"""
The user should not be able to create a chant with invalid text
Expand Down Expand Up @@ -3000,6 +3002,7 @@ def test_suggested_chant_buttons(self) -> None:
)
self.assertIsNone(response_after_rare_chant.context["suggested_chants"])

@skip("Temporarily disabled due to #1674")
def test_invalid_text(self) -> None:
"""
The user should not be able to create a chant with invalid text
Expand Down

0 comments on commit 56f3aab

Please sign in to comment.