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

Django 1.7 compatibility and SchemedHttpResponseRedirect #186

Closed
wants to merge 12 commits into from

Conversation

zopieux
Copy link
Contributor

@zopieux zopieux commented Jan 13, 2015

This PR fixes two things:

  • With Django 1.7 it becomes impossible to have root-level functions that return a model class, as they're not yet loaded. Thus, the code below will fail. As a temporary workaround, I used monkey-patching within the application registry to make it work. This is quite hacky but I don't see any other way. See: get_application_model incompatible with Django 1.7 #151
class MyForm(ModelForm):
  class Meta:
    model = some_func()
  • HttpResponseRedirect has a very restrictive list of allowed schemes (http, https, ftp) and fails with HTTP 400 for everything else. This prevents mobile (eg. Android) OAuth applications to use custom handlers eg. my-app-callback://oauth/. This PR adds a SchemedHttpResponseRedirect that allows all the schemes extracted from redirect_uris. As such, it remains safe.

The code has been live-tested but there are no unit tests yet.

Feel free to make comments I you want me to change things.

@zopieux
Copy link
Contributor Author

zopieux commented Jan 13, 2015

Do not merge! The monkey patching is completely broken for tests. I'll update this PR ASAP to address the issue.

Well, I did not notice there were two other PR and one issue for the "redirect" issue.

@zopieux
Copy link
Contributor Author

zopieux commented Jan 13, 2015

Okay let's do this the proper way.

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.

None yet

1 participant