Newbie CGI Question

Peter Hansen peter at engcorp.com
Mon Oct 6 21:16:07 EDT 2003


Michael Geary wrote:
> 
> > I'm having a problem when writing a cgi script that outputs content
> > type: text/html. I can control the color of the screen with print
> > '<back bgcolor="some color">' but I can't tile the screen with print
> > '<back background="foo.gif">'. Is tiling not an option with Python
> > CGI? A push in the right direction would be appreciated.
> >
> > I'm using Python 2.2.1 on Windows XP Pro running Apache 2.0.47 as
> > localhost for debug purposes. Thanks for any help provided.
> 
> CGI is just a way to generate an HTML page (and the HTTP headers that go
> with it). You're dealing with an HTML issue, not a Python issue.
> 
> So, you should start by forgetting about CGI completely. Use a text editor
> to create a .html file by hand, and load the file in your browser to test
> it. You can use any text editor and your favorite web browser and put them
> side by side on the screen. Each time you edit and save the file, hit the
> Refresh button in the browser to see how it's working.

As you say, it's entirely an HTML (or web server path issue) and nothing 
to do with Python, but the last suggestion can get a newbie into trouble 
when Windows is involved (as, of course, would almost any suggestion you
might happen to make ;-).

Internet Explorer by default uses an "automatic" setting for its cache
control, which means it tries and generally fails in situations like
the above to figure out when it should reload a page and when it should
just regenerate from the cache.

In spite of the docs noting that "just hitting Refresh" will bypass the
cache, it seems that with a setting of "Automatically" IE will skip that
step from time to time when it thinks the page isn't changing often 
enough for its tastes.  Use "Every visit to the page" instead, and
life will be easier (but you'll get no caching performance boost).

The relevant setting is under Internet Options->Temporary Files->Settings.

This is all also totally not Python-related... :-)

-Peter




More information about the Python-list mailing list