Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: profile field serialization in compiler view #1273

Merged

Conversation

axel7083
Copy link
Contributor

@axel7083 axel7083 commented Jun 9, 2024

Description

When creating custom presets, the /api/compiler is including the presets for each platforms, however when serialiazing the owner field a KeyError is raised.

As visible in the code bellow, we are tyring to get the request from the context.

class ProfileField(ProfileFieldBaseClass):
def to_representation(self, profile: Profile) -> Dict[str, Any]:
return serialize_profile(self.context["request"], profile)

However, in this specific context (serialiazing the owner field of a custom preset we include for a platform), it is not available.
image

We can clearly notice however that the serialize_profile function is not using the request argument we are sending, it uses the profile only. Therefore an easy fix is to remove the request.

Tests

  • regression unit tests has been added

@ethteck ethteck merged commit 7eb1d88 into decompme:main Jun 10, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants