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

Conflicting Treatment Slugs #2

Open
Sepero opened this issue Jul 19, 2012 · 0 comments
Open

Conflicting Treatment Slugs #2

Sepero opened this issue Jul 19, 2012 · 0 comments

Comments

@Sepero
Copy link

Sepero commented Jul 19, 2012

In the middleware function process_template_response, the following line is used:
request.session[EXPERIMENT_PREFIX+treatment.experiment.slug] = treatment.slug

This sets the treatment.slug in the session (not the treatment.id). What if there are +2 treatments with the same treatment.slug?

The treatment.slug is later retrieved in middleware function process_view, to reverse find the Treatment it belongs to.
treatment_slug = request.session[EXPERIMENT_PREFIX+goal.experiment.slug]
treatment = Treatment.objects.get(slug=treatment_slug)

If +2 Treatments use the same treatment.slug, then the developer cannot be sure which will be retrieved (or perhaps an error will occur?)

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

No branches or pull requests

1 participant