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

  • Home
  • SEARCH
  • 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 267989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:37:54+00:00 2026-05-11T23:37:54+00:00

Absolute beginner question: I have a template file index.html that looks like this: …

  • 0

Absolute beginner question:

I have a template file index.html that looks like this:

...
<FRAMESET ROWS="10%, *">
    <FRAME SRC="/top_frame">
    <FRAME SRC="{{ bottom_frame_url }}">
</FRAMESET>
...

And a request handler for /top_frame that looks like this:

class TopFrame(webapp.RequestHandler):
    def get(self):
        ...
        bottom_frame_url = self.request.get('bottom_frame_url')
        ...

As you can see I would like to have the value {{ bottom_frame_url }} that was used to generate my index.html, but how to I pass this value to my TopFrame request handler?

Thanks!

Edit: I am rendering index.html from another request handler:

class MainPage(webapp.RequestHandler):
def get(self):
    ...
    bottom_frame_url = Site.qql("WHERE Category = :1 ORDER BY date DESC",category_name)
    ...
    args = {
      ...
      'bottom_frame_url': bottom_frame_url,
      ...
    }
    index_path = os.path.join(os.path.dirname(__file__), 'index.html')     
    self.response.out.write(template.render(index_path, args))

But when we encounter “/top_frame” in the index.html template my TopFrame request handler is called:

class TopFrame(webapp.RequestHandler):
def get(self):
    ...
    bottom_frame_url = self.request.get('bottom_frame_url')
    ...
    args = {
        'bottom_frame_url': bottom_frame_url
    }
    self.response.out.write(template.render('topframe.html', args))

But self.request.get(‘bottom_frame_url’) does not seem to be reading any value. I know the value has been set in my index.html template because when I render the page the bottom frame shows as the website I set, but the top frame displays a traceback ending in the following error:

NameError: global name 'bottom_frame_url' is not defined

It looks like I have to put some more code in my index.html template to explicitly pass the value of bottom_frame_url to my TopFrame request handler. Is this correct?

The other thing I can think of is that although I am passing bottom_frame_url as an argument to render index.html, when I try to render topframe.html this argument isn’t available yet, because I haven’t rendered the bottom frame yet. Could this be the case?

  • 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-11T23:37:54+00:00Added an answer on May 11, 2026 at 11:37 pm

    It’s a parameter to the call to render the template:

    args = {
        bottom_frame_url: self.request.get('bottom_frame_url')
    }
    self.response.out.write(template.render('index.html', args))
    

    See http://code.google.com/appengine/docs/python/gettingstarted/templates.html

    Edit: I’m sorry, I misread the the question. I thought that the request handler containing the code you showed was the request handler for the frameset, but I see now that it isn’t.

    self.request.get can only get the parameters for the current HTTP request. Your setup will result in three HTTP requests: one for the frameset (with whatever URL that handler is), one for the top frame (with the URL “/top_frame”) and one for the bottom frame (with the URL specified by the bottom_frame_url parameter to the first HTTP request). The second and third won’t necessarily occur in that order, and there may be other requests for images and so on. But the order has no affect on what the top frame handler sees in self.request.get. Each request results in your app.yaml being consulted, and the appropriate Python script run, and the appropriate handler within it being called. Each request’s parameters are only what is set in the query string or POST params for that one request.

    So, if you want the handler for the top frame to see the bottom_frame_url via self.request.get, then you have to add it as a URL parameter for the request which causes the top frame handler to be run. Change the template to:

    <FRAMESET ROWS="10%, *">
        <FRAME SRC="/top_frame?bottom_frame_url={{bottom_frame_url}}">
        <FRAME SRC="{{ bottom_frame_url }}">
    </FRAMESET>
    

    Now when the browser requests the top frame, you will be able to access it in that handler, with self.request.get('bottom_frame_url'), just as you did in the handler for the frameset.

    Always remember when doing this kind of thing that users can change URL parameters to any values they like. If you can, it might be better to pull it from the database again in the other handler.

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

Sidebar

Ask A Question

Stats

  • Questions 191k
  • Answers 191k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use -1+2*((float)rand())/RAND_MAX rand() generates integers in the range [0,RAND_MAX] inclusive… May 12, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer For both cases database. You're going to be using the… May 12, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer When you use virtual mode, you provide your own logic… May 12, 2026 at 6:14 pm

Related Questions

Absolute beginner question: I have a template file index.html that looks like this: ...
If I have a matrix given as a list of rows [[1,2,3],[4,5,6]], I want
This is an absolute beginner's question, but per the latest podcast, I understand that
I'm an absolute beginner, you see. Say I have a string object on the
I'm an absolute beginner in Outlook programming and Windows GUI programming in general. But

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.