The fact that "request" is exposed is part of Pyramid. Any renderer hooked
up to pyramid will have at least 2 globals "request", "context". There are
also some others and it's all documented here:

http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/renderers.html#adding-a-new-renderer

I suppose that's not the most obvious spot for it but it is also discussed
in the tutorials.

On Wed, Nov 30, 2011 at 8:32 PM, Liang Leo <appli...@gmail.com> wrote:

> Michael,
>
> yes. i'm using pyramid_jinja2. and your advice works like a charm. thanks
> however i dig into the pyramid_jinja2 docs again to figure out whether i
> missed sth. but still i could not find anything talking about 'request is
> exposed in the template'
> so… is there another place where i can get more information about
> pyramid_jinja2? if so i won't need to bother the group in the future for
> related topics.
>
> The doc i refer to for pyramid_jinja2 is:
> http://docs.pylonsproject.org/projects/pyramid_jinja2/en/latest/index.html#
>
> Thanks
> Evan
>
>
>
> On 2011-12-1, at 上午3:35, Michael Merickel wrote:
>
> Sorry, is this a question about jinja2? If so there's another mailing list
> for that.
>
> If you are asking about pyramid_jinja2, for use in conjunction with
> pyramid then the request is already exposed in the template, so you can
> simply do "request.session['mykey']" to deal with the session.
>
> On Wed, Nov 30, 2011 at 5:58 AM, Evan <appli...@gmail.com> wrote:
>
>> hi group,
>>
>>  i'm using pyramid and jinja2 together, and i have trouble to access
>> the session data from jinja2,
>>  after some digging, i found this solution,
>>
>> http://stackoverflow.com/questions/2554174/how-do-i-access-session-data-in-jinja2-templates-bottle-framework-on-app-engine
>>
>>  but i'm not sure about whether this is the proper way to do, by this
>> way i need to get the env when setup,
>>  then add a 'session' key to jinja2's global vars when get a request,
>>  i think it means i need to do it in every view.
>>
>>  is there a better way to access the 'session' data from jinja2?
>>
>> Thanks,
>> Evan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-devel" group.
>> To post to this group, send email to pylons-devel@googlegroups.com.
>> To unsubscribe from this group, send email to
>> pylons-devel+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/pylons-devel?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-devel" group.
> To post to this group, send email to pylons-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-devel?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "pylons-devel" group.
> To post to this group, send email to pylons-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-devel?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to