Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjunk committed Oct 23, 2024
1 parent d2b68ae commit dee56ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions pydantic_forms/core/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ async def post_form(
try:
form_validated_data = generated_form(**user_input)
except ValidationError as e:
print("TYPE ERROR")
print(type(e.errors()[0]))
print(e.errors()[0])
print("TYPE TRANS")
translated_errors = tr.translate(e.errors(), locale="nl_NL")
print(type(translated_errors[0]))
print(translated_errors[0])
# print("TYPE ERROR")
# print(type(e.errors()[0]))
# print(e.errors()[0])
# print("TYPE TRANS")
# translated_errors = tr.translate(e.errors(), locale="nl_NL")
translated_errors = tr.translate(e.errors(), locale="en_US")
# print(type(translated_errors[0]))
# print(translated_errors[0])
e.errors = translated_errors
# for error in translated_errors:
# print(ErrorDetails(**error))
Expand Down Expand Up @@ -135,6 +136,8 @@ async def start_form(
form_key: name of form in the FORM dict
user_inputs: List of form inputs from frontend
user: User who starts this form
lang: Language of the form
extra_translations: Extra translations to apply to the form
extra_state: Optional initial state variables
Returns:
Expand Down
2 changes: 1 addition & 1 deletion pydantic_forms/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, validator_name: str, error: ValidationError):
super().__init__()
self.validator_name = validator_name
print("TYPE BEFORE CON")
print(type(error[0]))
# print(type(error[0]))
self.errors = list(convert_errors(error))

def __str__(self) -> str:
Expand Down

0 comments on commit dee56ce

Please sign in to comment.