Module Expr Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Assign AttributeStore NameLoad attr Dict Assign NameStore Call NameLoad NameLoad Str Dict Expr Call AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Str Dict If UnaryOpNot Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore Call NameLoad BinOpAdd Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Pass decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Return NameLoad Return NameLoad decorator_list decorator_list
N/A N/A 
Module provides mixin classes for dealing with updating context passed to
templates for rendering.

Example
-------

.. code-block:: python
    :linenos:

    from flask.ext.velox.mixins.context import ContextMixin
    from flask.ext.velox.mixins.template import TemplateMixin

    app = Flask(__name__)

    class MyView(TemplateMixin, ContextMixin):
        context = {
            'foo': 'bar'
        }

    app.add_url_rule('/', view_func=MyView.as_view('myview'))

    app.run()

 ContextMixin N/A object N/A N/A  Mixin this class to add context support to template
    rendering. Default context can be defined by setting the ``context``
    attribute to contain a ``dict`` of key value pairs.

    Attributes
    ----------
    context : dict, optional
        Default context to use when rendering the template

    Example
    -------

    .. code-block:: python
        :linenos:

        class FooView(ContextMixin):
            context = {
                'foo': 'bar',
            }

     __init__ N/A N/A self N/A args kwargs N/A N/A  Constructor

        Performs initial setup defining `_context` and merging
        `context`.
         N/A N/A self _context N/A N/A context N/A getattr self context N/A N/A N/A N/A self merge_context context N/A N/A hasattr self set_context N/A N/A N/A N/A self merge_context N/A N/A self set_context N/A N/A N/A N/A super ContextMixin self __init__ args kwargs N/A get_context N/A N/A self N/A N/A N/A  Propety method which returns the current context.

        Returns
        -------
        dict
           Current context value

         N/A _context N/A getattr self _context N/A N/A N/A N/A hasattr self _context N/A N/A N/A self _context _context N/A _context N/A update_context N/A N/A self new N/A N/A N/A  Overwrites the existing context with the provided new context
        value.

        Example
        -------
        >>> class FooView(ContextMixin):
        ...     context = {
        ...         'foo': 'bar',
        ...     }
        ...
        >>> view = FooView()
        >>> view.update_context({'hello': 'world'})
        {
            'hello': 'world'
        }

        Arguments
        ---------
        new : dict
            Value to update context too

        Returns
        -------
        dict
            The new context
         N/A N/A self _context new N/A new N/A merge_context N/A N/A self subject N/A N/A N/A  Merge the passed dictionary into the current `_context`

        Arguments
        ---------
        subject : dict
            The `dict` to merge into `_context`

        Example
        -------
        >>> class FooView(ContextMixin):
        ...     context = {
        ...         'foo': 'bar',
        ...     }
        ...
        >>> view = FooView()
        >>> view.merge_context({'hello': 'world'})
        >>> view.get_context()
        {
            'hello': 'world',
            'foo': 'bar'
        }

        Returns
        -------
        dict
            The new context

         N/A context N/A N/A self get_context N/A subject N/A N/A context N/A dict N/A N/A N/A context items N/A N/A subject items N/A N/A self _context context N/A context N/A set_context N/A N/A self N/A N/A N/A  A method which should be overridden when required to set extra
        context on a per view basis. This method is not required to be
        implemented however is the recommended way of setting extra context
         N/A N/A add_context N/A N/A self key val N/A N/A N/A 
        Adds a new element to the context.

        Arguments
        ---------
        key : str
            The context key name
        val
            The value of the new context item of any type

        Returns
        -------
        dict
            The new context
         N/A context N/A N/A self get_context N/A N/A context N/A key val N/A N/A self _context context N/A context N/A del_context N/A N/A self key N/A N/A N/A 
        Removes an element from the context dictionary.

        Example
        -------
        >>> class FooView(ContextMixin):
        ...     context = {
        ...         'foo': 'bar',
        ...     }
        ...
        >>> view = FooView()
        >>> view.del_context('foo')
        {}

        Arguments
        ---------
        key : str
            The context key name

        Returns
        -------
        bool
            Success or Failure

        Returns
        -------
        dict
            The new context
         N/A context N/A N/A self get_context N/A N/A N/A N/A N/A context pop key None N/A N/A self _context context N/A N/A N/A KeyError N/A N/A False N/A context N/A N/A