Code Monkey home page Code Monkey logo

Comments (2)

adamchainz avatar adamchainz commented on July 19, 2024

There’s no edict that the synchronous send() function should not be called from an asynchronous context. It’s legitimate but it does prevent the receivers from being asynchronous.

I don’t think we can remove the call as that is backwards incompatible. Maybe we can add an asend() call, though that would require significant restructuring.

the signal is my least favourite feature. It was added before I took over maintenance and I haven’t removed it due to backwards compatibility concerns. In most cases I think subclassjng the middleware makes more sense, though it’s not documented or well structured. If you have a specific use case, perhaps we can find a way to support that through subclassing.

from django-cors-headers.

Ariki avatar Ariki commented on July 19, 2024

It’s legitimate but it does prevent the receivers from being asynchronous.

It also prevents the receivers from accessing the database (which is my use case; my code was broken after upgrading from an older version of django-cors-headers).

But I'm ok with subclassing. My only concern is that I had to copy&paste the whole add_response_headers method into my subclass just to make its async version and be able to use await in the middle of it.

from django-cors-headers.

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.