Skip to content

Commit

Permalink
Merge branch 'fix-main-imports' into 'main'
Browse files Browse the repository at this point in the history
fix: Fix use of ListView, which was removed in main, with new TerraformVersionListView

See merge request pub/terra/terrarun!101
  • Loading branch information
MatthewJohn committed Aug 2, 2024
2 parents 8d4613a + 6d966fd commit 6668ea2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions terrarun/api_entities/terraform_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AttributeModifier,
BaseEntity,
EntityView,
ListEntityView,
)


Expand Down Expand Up @@ -103,3 +104,8 @@ class TerraformVersionView(TerraformVersionEntity, EntityView):
"""View for terraform-version"""

pass


class TerraformVersionListView(ListEntityView):

ENTITY_CLASS = TerraformVersionView
14 changes: 6 additions & 8 deletions terrarun/server/routes/admin_terraform_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

from flask import request

from terrarun.api_entities.base_entity import ListView
from terrarun.api_entities.terraform_version import (
TerraformVersionCreateEntity,
TerraformVersionUpdateEntity,
TerraformVersionView,
TerraformVersionListView,
)
from terrarun.errors import (
ApiError,
Expand Down Expand Up @@ -92,13 +92,11 @@ def _get(self, current_user, current_job):
version=version,
version_exact=version_exact,
)
views = [
TerraformVersionView.from_object(
tool, effective_user=current_user
)
for tool in tool_list
]
return ListView(views=views).to_response()
view = TerraformVersionListView.from_object(
obj=tool_list,
effective_user=current_user
)
return view.to_response()

def check_permissions_post(self, current_user, current_job):
"""Can only be access by site admins"""
Expand Down

0 comments on commit 6668ea2

Please sign in to comment.