try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident
def__delattr__(self, name): try: del self.__storage__[self.__ident_func__()][name] except KeyError: raise AttributeError(name)
2 Request Context
Request context includes request and session
Basically, each request comes
Capsulate environ into a RequestContext object
Add it into __storage__ dictionary
Dispatch request to each view file and do operation
Remove it from __storage__ dictionary
Picture for step 1, 2, 4
Picture for step 3 example
partial(): it is quite funcional programming object.__setattr__(self, '_LocalProxy__local', local): stuck here for quite a while. python3 documentation
近期评论