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

Method validate_avatar

app/forms/team.py:76–92  ·  view source on GitHub ↗
(self, field)

Source from the content-addressed store, hash-verified

74 raise ValidationError(_("A team with this slug already exists."))
75
76 def validate_avatar(self, field):
77 if field.data:
78 if field.data.content_type not in [
79 "image/jpeg",
80 "image/png",
81 "image/gif",
82 "image/webp",
83 ]:
84 raise ValidationError(
85 _(
86 "Invalid file type. Only JPEG, PNG, GIF and WebP images are allowed."
87 )
88 )
89 if field.data.size > 10 * 1024 * 1024: # 10MB
90 raise ValidationError(
91 _("File size exceeds the maximum allowed (10MB).")
92 )
93
94
95class TeamDeleteForm(StarletteForm):

Callers

nothing calls this directly

Calls 1

_Function · 0.50

Tested by

no test coverage detected