Skip to content

Commit

Permalink
using a variable for recomended max title length
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Aug 22, 2023
1 parent d72a132 commit f10f2ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/zimscraperlib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
),
}

RECOMMENDED_MAX_TITLE_LENGTH = 30
MAXIMUM_DESCRIPTION_METADATA_LENGTH = 80
MAXIMUM_LONG_DESCRIPTION_METADATA_LENGTH = 4000

Expand Down
3 changes: 2 additions & 1 deletion src/zimscraperlib/zim/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
MANDATORY_ZIM_METADATA_KEYS,
MAXIMUM_DESCRIPTION_METADATA_LENGTH,
MAXIMUM_LONG_DESCRIPTION_METADATA_LENGTH,
RECOMMENDED_MAX_TITLE_LENGTH,
)
from ..i18n import is_valid_iso_639_3
from ..image.probing import is_valid_image
Expand Down Expand Up @@ -40,7 +41,7 @@ def validate_standard_str_types(name: str, value: str):

def validate_title(name: str, value: str):
"""ensures Title metadata is within recommended length"""
if name == "Title" and len(value) > 30:
if name == "Title" and len(value) > RECOMMENDED_MAX_TITLE_LENGTH:
raise ValueError(f"{name} is too long.")


Expand Down

0 comments on commit f10f2ca

Please sign in to comment.