Jim Gallacher
jpg at jgassociates.ca
Sun May 7 10:39:25 EDT 2006
Graham Dumpleton wrote: > > On 07/05/2006, at 5:24 PM, Geoff Skerrett wrote: > >> I created a very simple program index.py program to help me understand >> the >> behavior. >> It is as follows; >> >> ### Begin index.py >> >> def index(req): >> req.write("I am in index()") >> >> def bar(req): >> req.write("I am in bar()") > > Whoops. Quite obvious really. You must use: > > def index(req): > return "I am in index()" > > def bar(req): > return "I am in bar()" > > When you you use req.write(), the headers are automatically flushed, so the > setting of req.content_type by mod_publisher after the published function > returns has no affect. > > In other words, if you are going to use req.write(), you must set > req.content_type > yourself. Geoff, Also, when you are using req.write() directly and not setting the content_type, you are depending on the browser making a best guess. You were getting different results because your browser was not consistent its guess. The behaviour will differ on various browsers. Jim
|