Giter VIP home page Giter VIP logo

Comments (17)

edmenendez avatar edmenendez commented on August 31, 2024 38

And.. It's because it's now called content_type.. not mimetype and HttpResponse should be called like

    return HttpResponse(
                json.dumps(response_data), content_type='application/json'
     )

from django-oauth2-provider.

tomwalters avatar tomwalters commented on August 31, 2024 1

Further to the comment by @edmenendez there are a number of lines in views.py namely: 301, 466 and 491 - the new (v1.7) HttpResponse constructor uses the param name content_type in place of mimetype, so a simple solution is to make the replacement.

from django-oauth2-provider.

blag avatar blag commented on August 31, 2024 1

@kevbradwick Upstream appears to be dead, so maybe never. If you absolutely cannot switch over to using Django OAuth Toolkit, then you should be able to use @glassresistor's zip file or repo.

Use pip to install the zip file:

$ pip install https://github.com/glassresistor/django-oauth2-provider/archive/stable.zip#django-oauth2-provider

or specify it directly in requirements.txt:

...
https://github.com/glassresistor/django-oauth2-provider/archive/stable.zip#django-oauth2-provider
...

Tell pip to install from @glassresistor's repository:

$ pip install -e git+https://github.com/glassresistor/django-oauth2-provider.git#egg=django-oauth2-provider

or specify it directly in requirements.txt:

...
-e git+https://github.com/glassresistor/django-oauth2-provider.git#egg=django-oauth2-provider
...

And just a heads up: unfortunately pip does not save where it installed packages from, so running pip freeze > requirements.txt will not write the appropriate URL to the requirements.txt file. C'est la vie, I guess.

from django-oauth2-provider.

psychok7 avatar psychok7 commented on August 31, 2024

any news on this?? i am having the same problem with Django 1.7

from django-oauth2-provider.

edmenendez avatar edmenendez commented on August 31, 2024

Same with Django 1.7. It's happening everywhere else I'm trying to return a HttpResponse with a mimetype. So this is not specific to django-oauth2-provider.

from django-oauth2-provider.

fankewong avatar fankewong commented on August 31, 2024

I've the same issue here in 1.7 ... anyone have solution?

mimetype="application/json"
File "/usr/local/lib/python2.7/dist-packages/django/http/response.py", line 318, in init
super(HttpResponse, self).init(*args, **kwargs)
TypeError: init() got an unexpected keyword argument 'mimetype'

from django-oauth2-provider.

psychok7 avatar psychok7 commented on August 31, 2024

my solution was to start using django oauth toolkit , when this gets fixed i might give it another try

from django-oauth2-provider.

edmenendez avatar edmenendez commented on August 31, 2024

Yes, change line 491 at https://github.com/caffeinehit/django-oauth2-provider/blob/master/provider/views.py#L491 to use content_type instead of mimetype.

from django-oauth2-provider.

antonagestam avatar antonagestam commented on August 31, 2024

@edmenendez In 1.7 there's a JSONResponse class, I think I used that in the pull request that's linked to this issue.

from django-oauth2-provider.

beaugunderson avatar beaugunderson commented on August 31, 2024

#93 fixes this as well.

from django-oauth2-provider.

theladyjaye avatar theladyjaye commented on August 31, 2024

+1 on this

from django-oauth2-provider.

bangonkali avatar bangonkali commented on August 31, 2024

Hi Guys, I followed the recommendations in this thread as a temporary solution for this issue. However, I'm using PIP. Somehow my latest PIP Install didn't include the fix. How do I make sure future PIP installations include the fix for this app? At the moment I'm manually fixing stuff on the server side and on my dev machine after using PIP. I really like PIP so I hope the fix will be available with PIP installation soons. Thanks.

from django-oauth2-provider.

 avatar commented on August 31, 2024

Further to the comment by @edmenendez and @tomwalters above, changing all instances of the mimetype function parameter and return in views.py as described worked for me. Django 1.7.1

from django-oauth2-provider.

kevbradwick avatar kevbradwick commented on August 31, 2024

Any ideas when this fix will make it in to master and released?

from django-oauth2-provider.

aravindaran avatar aravindaran commented on August 31, 2024

In Django 1.6, the HttpResponse is like
if mimetype:
warnings.warn("Using mimetype keyword argument is deprecated, use"
" content_type instead",
DeprecationWarning, stacklevel=2)
content_type = mimetype

We are just warning and assigning the mimetype to the content_type.

In Django 1.8, we are not using mimetype. Instead of this directly we are assigning the value like "image/png", etc.., to the content_type. Just a DRY concept.

from django-oauth2-provider.

alvinyeats avatar alvinyeats commented on August 31, 2024

I've the same issue here in 1.6.11

mimetype="application/json"
File "/usr/local/lib/python2.7/dist-packages/django/http/response.py", line 318, in init
super(HttpResponse, self).init(_args, *_kwargs)
TypeError: init() got an unexpected keyword argument 'mimetype'

Further to the comment by @edmenendez and @tomwalters above, changing all instances of the mimetype function parameter and return in views.py as described worked for me. Django 1.6.11

at https://docs.djangoproject.com/en/1.9/internals/deprecation/#deprecation-removed-in-1-7
I find this:
The mimetype argument to the init methods of HttpResponse, SimpleTemplateResponse, and TemplateResponse, will be removed. content_type should be used instead. This also applies to the render_to_response() shortcut and the sitemap views, index() and sitemap().

but i can't understand why the warning appear in django 1.6 until i saw the comment by @aravindaran

from django-oauth2-provider.

ckarrie avatar ckarrie commented on August 31, 2024

Fixed this in https://bitbucket.org/ckarrie/django-piston

from django-oauth2-provider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.