MCPcopy Create free account
hub / github.com/hunvreus/devpush / validate_avatar

Method validate_avatar

app/forms/project.py:467–483  ·  view source on GitHub ↗
(self, field)

Source from the content-addressed store, hash-verified

465 repo_id = IntegerField(_l("Repo ID"), validators=[DataRequired()])
466
467 def validate_avatar(self, field):
468 if field.data:
469 if field.data.content_type not in [
470 "image/jpeg",
471 "image/png",
472 "image/gif",
473 "image/webp",
474 ]:
475 raise ValidationError(
476 _(
477 "Invalid file type. Only JPEG, PNG, GIF and WebP images are allowed."
478 )
479 )
480 if field.data.size > 10 * 1024 * 1024: # 10MB
481 raise ValidationError(
482 _("File size exceeds the maximum allowed (10MB).")
483 )
484
485 def __init__(self, *args, db: AsyncSession, team: Team, project: Project, **kwargs):
486 super().__init__(*args, **kwargs)

Callers

nothing calls this directly

Calls 1

_Function · 0.50

Tested by

no test coverage detected