()
return pylons_vars
Create and return a dictionary of global Pylons variables

    Render functions should call this to retrieve a list of global
    Pylons variables that should be included in the global template
    namespace if possible.

    Pylons variables that are returned in the dictionary:
        ``c``, ``h``, ``_``, ``N_``, config, request, response,
        translator, ungettext, ``url``

    If SessionMiddleware is being used, ``session`` will also be
    available in the template namespace.
Create and return a dictionary of global Pylons variables
Create and return a dictionary of global Pylons variables
def pylons_globals():
    """Create and return a dictionary of global Pylons variables

    Render functions should call this to retrieve a list of global
    Pylons variables that should be included in the global template
    namespace if possible.

    Pylons variables that are returned in the dictionary:
        ``c``, ``h``, ``_``, ``N_``, config, request, response,
        translator, ungettext, ``url``

    If SessionMiddleware is being used, ``session`` will also be
    available in the template namespace.

    """
    conf = pylons.config._current_obj()
    c = pylons.tmpl_context._current_obj()
    app_globals = conf.get('pylons.app_globals')
    pylons_vars = dict(
        c=c,
        tmpl_context=c,
        config=conf,
        app_globals=app_globals,
        h=conf.get('pylons.h'),
        request=pylons.request._current_obj(),
        response=pylons.response._current_obj(),
        url=pylons.url._current_obj(),
        translator=pylons.translator._current_obj(),
        ungettext=pylons.i18n.ungettext,
        _=pylons.i18n._,
        N_=pylons.i18n.N_
    )

    # If the session was overriden to be None, don't populate the session
    # var
    econf = pylons.config['pylons.environ_config']
    if 'beaker.session' in pylons.request.environ or \
        ('session' in econf and econf['session'] in pylons.request.environ):
        pylons_vars['session'] = pylons.session._current_obj()
    log.debug("Created render namespace with pylons vars: %s", pylons_vars)
    return pylons_vars
def pylons_globals ( ) : conf = pylons . config . _current_obj ( ) c = pylons . tmpl_context . _current_obj ( ) app_globals = conf . get ( 'pylons.app_globals' ) pylons_vars = dict ( c = c , tmpl_context = c , config = conf , app_globals = app_globals , h = conf . get ( 'pylons.h' ) , request = pylons . request . _current_obj ( ) , response = pylons . response . _current_obj ( ) , url = pylons . url . _current_obj ( ) , translator = pylons . translator . _current_obj ( ) , ungettext = pylons . i18n . ungettext , _ = pylons . i18n . _ , N_ = pylons . i18n . N_ ) # If the session was overriden to be None, don't populate the session # var econf = pylons . config [ 'pylons.environ_config' ] if 'beaker.session' in pylons . request . environ or ( 'session' in econf and econf [ 'session' ] in pylons . request . environ ) : pylons_vars [ 'session' ] = pylons . session . _current_obj ( ) log . debug ( "Created render namespace with pylons vars: %s" , pylons_vars ) return pylons_vars