MCPcopy Index your code
hub / github.com/hunvreus/devpush / validate_slug

Method validate_slug

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

Source from the content-addressed store, hash-verified

217 )
218
219 def validate_slug(self, field):
220 if self.environment_id.data: # type: ignore
221 env = self.project.get_environment_by_id(self.environment_id.data) # type: ignore
222 if field.data == env["slug"]:
223 return
224
225 if env["slug"] == "production":
226 raise ValidationError(
227 _("The production environment identifier cannot be modified.")
228 )
229
230 # New environment
231 if self.project.has_active_environment_with_slug(field.data):
232 raise ValidationError(
233 _("This identifier is already in use by another environment.")
234 )
235
236
237class ProjectEnvironmentRemoveForm(StarletteForm):

Callers

nothing calls this directly

Calls 3

get_environment_by_idMethod · 0.80
_Function · 0.50

Tested by

no test coverage detected