Skip to content
Myr

Document required signature of before_request functions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Unless you happened to also read preprocess_request()'s docstring, it wasn't not obvious that return values from these functions are treated as response values.

authored by Chris Rebert · committed by Chris Rebert · parent a45fce8 · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:flask/app.py+7 added-1 removed
1241 unmodified lines
1242 self.jinja_env.globals[name or f.__name__] = f12431244 @setupmethod1245 def before_request(self, f):1246 """Registers a function to run before each request."""1246 """Registers a function to run before each request.12471248 The function will be called without any arguments.1249 If the function returns a non-None value, it's handled as1250 if it was the return value from the view and further1251 request handling is stopped.1252 """1253 self.before_request_funcs.setdefault(None, []).append(f)1254 return f12551256 @setupmethod
660 unmodified lines