Thread local proxy
from neotasker import g
if not g.has('db'):
g.set('db', <new_db_connection>)
Supports methods:
-
class
neotasker.
LocalProxy
Simple proxy for threading.local namespace
-
clear
(attr) Clear (delete) thread-local attribute
Parameters: attr – attribute name
-
get
(attr, default=None) Get thread-local attribute
Parameters: - attr – attribute name
- default – default value if attribute is not set
Returns: attribute value or default value
-
has
(attr) Check if thread-local attribute exists
Parameters: attr – attribute name Returns: True if attribute exists, False if not
-
set
(attr, value) Set thread-local attribute
Parameters: - attr – attribute name
- value – attribute value to set
-