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 7035349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:17:38+00:00 2026-05-28T01:17:38+00:00

On all my template rendering for a particular app, the output ends with None

  • 0

On all my template rendering for a particular app, the output ends with None:

...</html>None

This must be a bug and probably in my code and I’ve spent days trying to track it down. There’s nothing special about my app and this bug appears on every page I use template rendering, whether I use a seperate template engine or not. There is nothing special about my code:

    class Objectives(NewBaseHandler):

        @user_required
        def get(self):
            user = auth_models.User.get_by_id(long(self.auth.get_user_by_session()['user_id']))
            if user:
                self.render_template('objectives.html', {'user': user})
            else:

                self.render_template('/', {})

class NewBaseHandler(BaseHandler):

    """
........BaseHandler for all requests

........Holds the auth and session properties so they are reachable for all requests
...."""

    def dispatch(self):
        """
............Save the sessions for preservation across requests
........"""

        # self.session_store = sessions.get_store(request=self.request)
        # if self.request.host.find('localhost') > 0:  # for a Swedish domain that uses Swedish
        # or lang = os.environ.get("HTTP_ACCEPT_LANGUAGE")

        i18n.get_i18n().set_locale('sv')
        lang_code_get = self.request.get('hl', None)
        if lang_code_get:
           #self.session['i18n_language'] = lang_code_get
           i18n.get_i18n().set_locale(lang_code_get)
        try:
            response = super(NewBaseHandler, self).dispatch()
            self.response.write(response)
        finally:
            self.session_store.save_sessions(self.response)

    @webapp2.cached_property
    def auth(self):
        return auth.get_auth()

    @webapp2.cached_property
    def session_store(self):
        return sessions.get_store(request=self.request)

    @webapp2.cached_property
    def auth_config(self):
        """
............Dict to hold urls for login/logout
........"""

        return {'login_url': self.uri_for('login'),
                'logout_url': self.uri_for('logout')}

class BaseHandler(webapp2.RequestHandler):

    @webapp2.cached_property
    def jinja2(self):
        return jinja2.get_jinja2(app=self.app)

    def render_template(self, file, template_args):
        path = os.path.join(os.path.dirname(__file__), 'templates',
                            file)
        self.response.out.write(template.render(path, template_args))

    def render_jinja(self, filename, **template_args):
        self.response.write(self.jinja2.render_template(filename,
                            **template_args))

How can I check where the output None is coming from? It’s probably not coming from the template and it doesn’t seem to be coming from the handlers and there is no other code.

Thank you

  • 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-05-28T01:17:39+00:00Added an answer on May 28, 2026 at 1:17 am

    In Objectives.get() you must return a value. Since you don’t do this Python assumes the result is None. This value you get in NewBaseHandler.dispatch() when calling to base dispatch implementation and then write it to response.

    If I get your app correctly returning empty string in get method will solve the problem.

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

Sidebar

Related Questions

We've created an HTML template that is rendering correctly on all email clients except
I have a HTML template that I'm rendering using Django. I'm passing in all
I'm not sure why this template is not rendering anything to the page. Is
I'm running into a blind spot with backbone.js. I've written this code and all
My wordpress*(a custom template)* nav is all working on all of the pages but
I want to remove all vba-modules from an MS Word template using VBScript. I
At my template, I want to iterate through all form errors, including the ones
Is it possible to do template layouts which you can assign to all your
To specialize a class template, one has to redefine all of the member functions
I am using MinifyJS.tt which is a T4 template to minify all my JS

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.