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

New implementation of lazy strings #80

Merged
merged 3 commits into from
Jul 21, 2022
Merged

New implementation of lazy strings #80

merged 3 commits into from
Jul 21, 2022

Conversation

kbairak
Copy link
Member

@kbairak kbairak commented Jul 11, 2022

Solves #79 (hopefully).

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2022

Codecov Report

Merging #80 (81c67c3) into devel (975a685) will decrease coverage by 0.32%.
The diff coverage is 79.33%.

@@            Coverage Diff             @@
##            devel      #80      +/-   ##
==========================================
- Coverage   77.75%   77.42%   -0.33%     
==========================================
  Files          37       46       +9     
  Lines        2841     3801     +960     
==========================================
+ Hits         2209     2943     +734     
- Misses        632      858     +226     
Impacted Files Coverage Δ
transifex/native/__init__.py 100.00% <ø> (ø)
transifex/native/django/apps.py 54.16% <ø> (ø)
transifex/native/cds.py 89.14% <42.10%> (-8.16%) ⬇️
transifex/api/jsonapi/auth.py 58.06% <58.06%> (ø)
transifex/api/jsonapi/compat.py 65.21% <65.21%> (ø)
transifex/native/django/management/utils/push.py 86.36% <66.00%> (-9.26%) ⬇️
transifex/native/django/utils/__init__.py 81.25% <66.66%> (-10.42%) ⬇️
transifex/native/core.py 91.04% <72.72%> (-3.88%) ⬇️
transifex/common/utils.py 97.77% <75.00%> (+0.02%) ⬆️
transifex/api/jsonapi/collections.py 75.88% <75.88%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 032163c...81c67c3. Read the comment docs.

Django's makemigrations command has some trouble with our LazyStrings.
When LazyStrings are used as choices in a `models.TextChoices` subclass,
the migration file will either have:

1. The return value of `__repr__`
2. The underlying string, which in the initial implementation was ''

We add an optional fallback_value keyword argument to be used as both
the value of the underlying string and as the return value of `__repr__`
so that makemigrations will produce a correct migration file.
@kbairak kbairak marked this pull request as ready for review July 13, 2022 13:56
@kbairak kbairak merged commit 9f1e357 into devel Jul 21, 2022
@kbairak kbairak deleted the new_lazy_strings branch July 21, 2022 07:24
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.

3 participants