OpenQuizz
Une application de gestion des contenus pédagogiques
LocalProxy Class Reference
Inheritance diagram for LocalProxy:
Collaboration diagram for LocalProxy:

Public Member Functions

def __init__ (self, local, name=None)
 
def __dict__ (self)
 
def __repr__ (self)
 
def __bool__ (self)
 
def __unicode__ (self)
 
def __dir__ (self)
 
def __getattr__ (self, name)
 
def __setitem__ (self, key, value)
 
def __delitem__ (self, key)
 
def __setslice__ (self, i, j, seq)
 
def __delslice__ (self, i, j)
 

Detailed Description

Acts as a proxy for a werkzeug local.  Forwards all operations to
a proxied object.  The only operations not supported for forwarding
are right handed operands and any kind of assignment.

Example usage::

    from werkzeug.local import Local
    l = Local()

    # these are proxies
    request = l('request')
    user = l('user')


    from werkzeug.local import LocalStack
    _response_local = LocalStack()

    # this is a proxy
    response = _response_local()

Whenever something is bound to l.user / l.request the proxy objects
will forward all operations.  If no object is bound a :exc:`RuntimeError`
will be raised.

To create proxies to :class:`Local` or :class:`LocalStack` objects,
call the object as shown above.  If you want to have a proxy to an
object looked up by a function, you can (as of Werkzeug 0.6.1) pass
a function to the :class:`LocalProxy` constructor::

    session = LocalProxy(lambda: get_current_request().session)

.. versionchanged:: 0.6.1
   The class can be instantiated with a callable as well now.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  local,
  name = None 
)

Member Function Documentation

◆ __bool__()

def __bool__ (   self)

◆ __delitem__()

def __delitem__ (   self,
  key 
)

◆ __delslice__()

def __delslice__ (   self,
  i,
  j 
)

◆ __dict__()

def __dict__ (   self)

◆ __dir__()

def __dir__ (   self)

◆ __getattr__()

def __getattr__ (   self,
  name 
)

◆ __repr__()

def __repr__ (   self)

◆ __setitem__()

def __setitem__ (   self,
  key,
  value 
)

◆ __setslice__()

def __setslice__ (   self,
  i,
  j,
  seq 
)

◆ __unicode__()

def __unicode__ (   self)

The documentation for this class was generated from the following file: