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

(v3) Cast potentially translated strings used as descriptions #976

Merged
merged 3 commits into from Jun 6, 2020

Conversation

DoctorJohn
Copy link
Contributor

This PR fixes #975 by explicitly casting all potentially translated strings used as descriptions to str. (graphql-core and its print_schema utility expects descriptions to be of type str).

…translation

Before graphql-core had issues processing descriptions generated from
translatable help_text during schema generation. Involved graphql-core
utilities expect descriptions to be of type `str`, however, the generated
descriptions were of type `django.utils.functional.__proxy__` which caused
concatination with actual strings to fail.
@DoctorJohn DoctorJohn changed the base branch from master to v3 June 4, 2020 18:58
@DoctorJohn DoctorJohn changed the title Cast potentially translated strings used as descriptions (v3) Cast potentially translated strings used as descriptions Jun 4, 2020
Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DoctorJohn !

Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I've just noticed that the tests are failing. Could you fix them?

@DoctorJohn
Copy link
Contributor Author

I already took a look at both failing tests on my machine and I figured that their failure is not related to my changes (they already failed without my changes). I'm working on a patch to fix those tests but thought it would be better to submit it separately.

@DoctorJohn
Copy link
Contributor Author

DoctorJohn commented Jun 6, 2020

I already took a look at both failing tests on my machine and I figured that their failure is not related to my changes (they already failed without my changes). I'm working on a patch to fix those tests but thought it would be better to submit it separately.

Never mind, I might be mistaking. Lemme take another look

@DoctorJohn
Copy link
Contributor Author

@jkimbo I fixed the issue causing the tests to fail. Feel free to take another look

Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks

@jkimbo jkimbo merged commit b320b94 into graphql-python:v3 Jun 6, 2020
@jkimbo
Copy link
Member

jkimbo commented Jun 6, 2020

Released a new beta version with this change

andrei-datcu added a commit to andrei-datcu/graphene-django that referenced this pull request Aug 11, 2021
graphql-python#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.
tcleonard pushed a commit that referenced this pull request Sep 22, 2022
* Cast translated description for DecimalField

#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
VV-YY added a commit to VV-YY/graphene-django that referenced this pull request Jan 18, 2023
* Cast translated description for DecimalField

graphql-python/graphene-django#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
paxaxel223 added a commit to paxaxel223/graphe-django that referenced this pull request Apr 25, 2023
* Cast translated description for DecimalField

graphql-python/graphene-django#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
spartacus0816 pushed a commit to spartacus0816/django_dev that referenced this pull request May 22, 2023
* Cast translated description for DecimalField

graphql-python/graphene-django#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
azuredevil0818 pushed a commit to azuredevil0818/graphene-django that referenced this pull request Jul 4, 2023
* Cast translated description for DecimalField

graphql-python/graphene-django#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
superlevure pushed a commit to loft-orbital/graphene-django that referenced this pull request Jul 19, 2023
* Cast translated description for DecimalField

graphql-python#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
DevStar1016 added a commit to DevStar1016/graphine-django that referenced this pull request Sep 11, 2023
* Cast translated description for DecimalField

graphql-python/graphene-django#976 casts all the description fields to strings to prevent schema printing from failing whenever the description is a lazy translated string. The `DecimalField` however got in after the v3 merge and it currently misses the cast.

* Fix row size
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.

Schema management command broken in 3.0.0b1
2 participants