コード例 #1
0
 def configure(self, binder: Binder) -> None:
     # Starting with Injector 0.13.2 explicit scope binding is no longer
     # necessary
     if injector_version < '0.13.2':
         binder.bind_scope(self.request_scope_class)
     binder.bind(flask.Flask, to=self.app, scope=singleton)
     binder.bind(Config, to=self.app.config, scope=singleton)
     binder.bind(Request, to=lambda: flask.request)
コード例 #2
0
 def configure(self, binder: Binder) -> None:
     binder.bind_scope(self.request_scope_class)
     binder.bind(flask.Flask, to=self.app, scope=singleton)
     binder.bind(Config, to=self.app.config, scope=singleton)
     binder.bind(Request, to=lambda: flask.request)