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

Class StorageProjectRemoveForm

app/forms/storage.py:222–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221
222class StorageProjectRemoveForm(StarletteForm):
223 association_id = HiddenField(_l("Association ID"), validators=[DataRequired()])
224 confirm = StringField(_l("Confirmation"), validators=[DataRequired()])
225
226 def __init__(
227 self, request: Request, *args, associations: list["StorageProject"], **kwargs
228 ):
229 super().__init__(request, *args, **kwargs)
230 self.associations = associations
231 self._associations_by_id = {
232 str(association.id): association for association in associations
233 }
234 self.association = None
235
236 def validate_association_id(self, field):
237 association = self._associations_by_id.get(field.data)
238 if not association:
239 raise ValidationError(_("Association not found."))
240 self.association = association
241
242 def validate_confirm(self, field):
243 if not self.association:
244 return
245 project_name = self.association.project.name if self.association.project else ""
246 if field.data != project_name:
247 raise ValidationError(_("Project name confirmation did not match."))
248
249
250class StorageQueryForm(StarletteForm):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected