Skip to content

Commit eab18c0

Browse files
Inline project creation attributes
1 parent 0bf6f0f commit eab18c0

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

api/views/project_create.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,6 @@ def project_create_dates(input_data):
9797
return dates, None
9898

9999

100-
def project_create_attrs(course, project_data):
101-
values, error = project_create_values(course, project_data)
102-
if error:
103-
return None, error
104-
105-
attrs = project_model_attrs(project_data, values)
106-
return attrs, None
107-
108-
109100
def project_create_values(course, project_data):
110101
input_data, error = project_create_input(project_data)
111102
if error:
@@ -147,10 +138,11 @@ def project_model_attrs(project_data, values):
147138

148139

149140
def create_project(course, project_data):
150-
attrs, error = project_create_attrs(course, project_data)
141+
values, error = project_create_values(course, project_data)
151142
if error:
152143
return None, error
153144

145+
attrs = project_model_attrs(project_data, values)
154146
project = Project.objects.create(
155147
course=course,
156148
**attrs,

docs/refactoring-plan.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,6 +2915,20 @@ Steps:
29152915
`wide_positional_calls=0`, `wide_function_args=0`,
29162916
`nested_wide_for_unpacking=0`, `range_len_loops=0`), and
29172917
`git diff --check`.
2918+
- [x] 2026-07-02: Removed the single-use project creation attributes wrapper.
2919+
`create_project` now calls `project_create_values` and `project_model_attrs`
2920+
directly before `Project.objects.create`, keeping validation and payload
2921+
construction named without a pass-through layer. Verification:
2922+
`uv run ruff check api/views/project_create.py docs/refactoring-plan.md`,
2923+
`python -m py_compile api/views/project_create.py`,
2924+
`uv run python manage.py test api.tests.test_project_creation api.tests.test_projects`,
2925+
removed-helper reference scan, touched-function line-threshold scan,
2926+
`uvx pyrefly check`, repository AST cleanup scan excluding migrations
2927+
(`forbidden_comprehensions=0`, `threshold_violations=0`,
2928+
`append_constructed=0`, `wide_tuple_unpacking=0`,
2929+
`wide_positional_calls=0`, `wide_function_args=0`,
2930+
`nested_wide_for_unpacking=0`, `range_len_loops=0`), and
2931+
`git diff --check`.
29182932
- [x] Split Datamailer campaign action data construction out of the campaign
29192933
action handler so the handler only resolves the client, builds action data,
29202934
and runs the guarded action. Verification:

0 commit comments

Comments
 (0)