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

Custom django-waffle middleware to store testing flags #1109

Merged

Conversation

madprime
Copy link
Member

@madprime madprime commented May 8, 2020

Description

This makes django-waffle testing flags "stick" when not used by an initial view or template.

django-waffle has an open issue regarding testing flags not being stored in cookie unless there's some attempt to use them in a view or template: jazzband/django-waffle#80

While the issue seems to think this isn't solvable without breaking backwards compatibility, it seems like my modification to the middleware should generally work? (It uses the flag customization that was described as an issue.)

So, this seems to work for me, but maybe I'm missing something. (And I might submit this solution as a PR to django-waffle.)

Testing

  • Manually tested that a waffle testing flag is now set in a request/response that previously lost the flag (our login redirect)
  • Passed automated testing

@madprime madprime merged commit 9b3fb07 into OpenHumans:master May 8, 2020
dragon-dxw added a commit to jazzband/django-waffle that referenced this pull request May 3, 2024
dragon-dxw added a commit to jazzband/django-waffle that referenced this pull request May 3, 2024
dragon-dxw added a commit to jazzband/django-waffle that referenced this pull request May 3, 2024
@dragon-dxw
Copy link

dragon-dxw commented May 3, 2024

@madprime I've made that PR because I fell into the same trap. Could you chime in on jazzband/django-waffle#505 and confirm that you're happy for your code to be used in the project in this way? And possibly any problems that implementing these changes might cause?

@gedankenstuecke
Copy link
Member

hey @dragon-dxw, at least we didn't run into any issues with it, but also have to say we didn't end up using it a whole lot on our end!

Regarding using the code: I can't speak for @madprime, but would assume that yes, as our code base is MIT licensed 🙂

dragon-dxw added a commit to jazzband/django-waffle that referenced this pull request Jun 4, 2024
dragon-dxw added a commit to jazzband/django-waffle that referenced this pull request Jul 3, 2024
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