Package expedient :: Package common :: Package middleware :: Module threadlocals
[hide private]
[frames] | no frames]

Module threadlocals

source code

Author: jnaous

Classes [hide private]
Raised when models.ThreadLocals.add_parser is called twice for the same keyword.
Middleware that gets various objects from the request object and saves them in thread local storage.
Functions [hide private]
Push a new frame on the stack.
source code
Pop a frame from the stack.
source code
Returns the dictionary of all parsed keywords in the request.
source code
add_parser(kw, func)
Add a request parser for a keyword.
source code
Get the parser function stored for the keyword kw or None if it doesn't exist.
source code
Variables [hide private]
  _thread_locals = threadlocal()
  __package__ = 'expedient.common.middleware'
Function Details [hide private]

add_parser(kw, func)

source code 

Add a request parser for a keyword. When a request arrives, the parser func will be used to set the value for the kw keyword in the thread-local storage.

  • kw (hashable value) - The keyword to use for the result of this parser.
  • func (callable.) - a function that accepts the request and returns a value