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

Class ProjectCreateForm

app/forms/project.py:509–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507
508
509class ProjectCreateForm(StarletteForm):
510 name = StringField(
511 _l("Project name"),
512 validators=[
513 DataRequired(),
514 Length(min=1, max=100),
515 Regexp(
516 r"^[A-Za-z0-9][A-Za-z0-9._-]*[A-Za-z0-9]$",
517 message=_l(
518 "Project names can only contain letters, numbers, hyphens, underscores and dots. They cannot start or end with a dot, underscore or hyphen."
519 ),
520 ),
521 ],
522 )
523 repo_id = IntegerField(_l("Repo ID"), validators=[DataRequired()])
524 production_branch = StringField(
525 _l("Production branch"), validators=[DataRequired(), Length(min=1, max=255)]
526 )
527 preset = SelectField(
528 _l("Framework presets"),
529 choices=[],
530 validators=[Optional(), Length(max=255)],
531 )
532 runner = SelectField(
533 _l("Runner"),
534 choices=[],
535 validators=[DataRequired(), Length(min=1, max=255)],
536 )
537 root_directory = StringField(
538 _l("Root directory"),
539 validators=[
540 Length(max=255, message=_l("Root directory cannot exceed 255 characters")),
541 Regexp(
542 r"^[a-zA-Z0-9_\-./]*$",
543 message=_l(
544 "Root directory can only contain letters, numbers, dots, hyphens, underscores, and forward slashes"
545 ),
546 ),
547 ],
548 )
549 build_command = StringField(_l("Build command"))
550 pre_deploy_command = StringField(_l("Pre-deploy command"))
551 start_command = StringField(
552 _l("Start command"), validators=[DataRequired(), Length(min=1)]
553 )
554 env_vars = FieldList(FormField(ProjectEnvVarForm))
555 submit = SubmitField(_l("Save"))
556
557 validate_root_directory = validate_root_directory
558
559 def __init__(self, *args, db: AsyncSession, team: Team, **kwargs):
560 super().__init__(*args, **kwargs)
561 self.db = db
562 self.team = team
563 settings = get_settings()
564 registry_state = RegistryService(Path(settings.data_dir) / "registry").state
565 self._runners = registry_state.runners
566 self._presets = registry_state.presets

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected