Skip to content

Commit

Permalink
Fix: Replaced .dict() by .model_dump() and .json() by `.model_d…
Browse files Browse the repository at this point in the history
…ump_json()`
  • Loading branch information
Andres D. Molins committed Oct 24, 2024
1 parent 486b461 commit b5e05f1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/aleph/schemas/base_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def check_item_type(self):
raise ValueError(
f"Expected {expected_item_type} based on hash but item type is {item_type}."
)
return self

@classmethod
@field_validator("item_hash", mode="after")
Expand Down
2 changes: 1 addition & 1 deletion src/aleph/schemas/pending_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class BasePendingMessage(AlephBaseMessage, Generic[MType, ContentType]):
A raw Aleph message, as sent by users to the Aleph network.
"""

@model_validator(mode="before")
@classmethod
@model_validator(mode="before")
def load_content(cls, values):
"""
Preload inline content. We let the CCN populate this field later
Expand Down
2 changes: 2 additions & 0 deletions src/aleph/web/controllers/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ def validate_field_dependencies(self):
if start_block and end_block and (end_block < start_block):
raise ValueError("end block cannot be lower than start block.")

return self

@classmethod
@field_validator(
"hashes",
Expand Down
2 changes: 2 additions & 0 deletions src/aleph/web/controllers/posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def validate_field_dependencies(self):
if start_date and end_date and (end_date < start_date):
raise ValueError("end date cannot be lower than start date.")

return self

@classmethod
@field_validator(
"addresses", "hashes", "refs", "post_types", "channels", "tags", mode="before"
Expand Down

0 comments on commit b5e05f1

Please sign in to comment.