0

A wsgiref application function has to look as follows:

def application(environ, start_response):

start_response is just a function, while environ does not have any parameters set by the user (https://www.python.org/dev/peps/pep-3333/#environ-variables).
Given this, how could user-defined variables be used by the application without making them global?

wojciech-graj
  • 25
  • 1
  • 5

1 Answers1

0

Figured it out. the application function can be part of a class, allowing for self to be taken as an argument. The class can hold any data which will be needed by the application.

class XYZ:
    def application(self, environ, start_response):
wojciech-graj
  • 25
  • 1
  • 5