GithubHelp home page GithubHelp logo

Bug: `_TemplateResponse` is still relying on `request` key from `context` which maybe different from `request` argument to `TemplateResponse`. about starlette HOT 4 CLOSED

apiwat-chantawibul avatar apiwat-chantawibul commented on May 28, 2024
Bug: `_TemplateResponse` is still relying on `request` key from `context` which maybe different from `request` argument to `TemplateResponse`.

from starlette.

Comments (4)

alex-oleshkevich avatar alex-oleshkevich commented on May 28, 2024 1

Feel free to reopen this ticket in case if you still have questions.

from starlette.

alex-oleshkevich avatar alex-oleshkevich commented on May 28, 2024

@apiwat-chantawibul while I agree that having it in the context is not required anymore, removing request from the context is a breaking change as projects expect this variable to be automatically available in templates.

We can have request as constructor argument of _TemplateResponse and it is an option. However I am not sure if it is a good idea. Many developers are used to have request variable in the template context (so does Django, so do we) and I would prefer to keep this convention further.

What do you think @Kludex ?

from starlette.

Kludex avatar Kludex commented on May 28, 2024

The changes that we propose ourselves on 1.0 solve this issue, right?

from starlette.

alex-oleshkevich avatar alex-oleshkevich commented on May 28, 2024

Yes, it would be possible to override request context variable in v1.0.
See https://github.com/encode/starlette/pull/2384/files#diff-e36747b146f2f9c644d1ae076c13ee41df4a81132f25f14ebe9c6ad4facb1352L225

cc @apiwat-chantawibul

from starlette.

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.