Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8220973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:44:09+00:00 2026-06-07T13:44:09+00:00

I am building a project on GAE, webapp2, jinja2 and I use engineauth for

  • 0

I am building a project on GAE, webapp2, jinja2 and I use engineauth for authorization. I need something like Django’s context_processor in order to use session, user and some other variables from webapp2.request in templates. Please, help me to solve this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:44:11+00:00Added an answer on June 7, 2026 at 1:44 pm

    There are many ways to achieve this.

    The simplest way probably looks like this:

    def extra_context(handler, context=None):
        """
        Adds extra context.
        """
    
        context = context or {}
    
        # You can load and run various template processors from settings like Django does.
        # I don't do this in my projects because I'm not building yet another framework
        # so I like to keep it simple:
    
        return dict({'request': handler.request}, **context)
    
    
    # --- somewhere in response handler ---
    def get(self):
        my_context = {}
        template = get_template_somehow()
        self.response.out.write(template.render(**extra_context(self, my_context))
    

    I like when my variables are in template globals, then I can access them in my template widgets without having to pass around bunch of vars in template. So I am doing it like this:

    def get_template_globals(handler):
        return {
            'request': handler.request,
            'settings': <...>
        }
    
    
    class MyHandlerBase(webapp.RequestHandler):
        def render(self, context=None):
            context = context or {}
            globals_ = get_template_globals(self)
            template = jinja_env.get_template(template_name, globals=globals_)
            self.response.out.write(template.render(**context))
    

    There are other methods in: Context processor using Werkzeug and Jinja2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building a project and I would like to make use of some
When building Android project in Eclipse, Android SDK gives error like this: error: Description
I made a usercontrol in my project, and after building project, I need to
I'm building a project for school and I thought I'd like to slip in
I am currently building my project locally using MVC. The user enters some search
I am building a project in VS2005 and several of my DLLs are failing
when I was building my project done in ASP.NET and C#, it produced the
I'm building my project with maven so according to maven way, config should be
I am building a project in Visual C++ 2008, which is an example MFC-based
I'm having problems building a project under the Android NDK. Most likely its due

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.