#761·bottle

Proposal for request global removal

Author: foxxCreated Jun 5, 2015Updated Sep 7, 2024
LabelsFeatureNeeds inputNeeds testsNeeds docs

Currently the request context is stored in the request global, which can encourage anti patterns such as accessing the request object from a database model.

I'm thinking that a cleaner approach would be to pass in the request context to the view function itself, rather than having to access it from a global. This object would then be passed around as/where it was needed, encouraging modularity by design.

python
def some_view(request):
    print request

Could a core maintainer give their thoughts?