[mod_python] Text appended to the page when refreshing

Wojtek Dabrowski falka777 at gmx.de
Tue Jul 12 18:09:11 EDT 2005


> I'm using the publisher handler and when i refresh a page that returns
> some html code (a full page, enclosed in html tags) the output is
> appended to the page (duplicated, if the python script isn't changed).

I have had a similiar problem. In my case, the output was generated as a
list of lines, kind of like:

def handler(req):
  page=bla()
  for line in page.x:
    req.write(line)

class bla:
  x = list()
  def __init__(self):
    self.x.append("HTML lines")

Now x=list didn't generate an empty list, but x sometimes still held the
output generated last time the page was called. I corrected this by
adding an x=[] in the __init__ to get:

class bla:
  x = list()
  def __init__(self):
    x=[]
    self.x.append("HTML lines")

This cleared x of any garbage that might have been there, and it works
fine now.

I don't know why x=list() didn't generate an empty list, I just know it
didn't ;) If there's anybody who can actually explain why this happened,
I'd be grateful.

Have a nice day,
-Wojtek

--
This is a .signature-virus. If you see this, copy it into your .signature!
If you don't know what a .signature is, you've most probably been
infected by another virus of name Microsoft. In this case, please remove
yourself from my fov or infect yourself with linux ;)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050713/e5a5080a/signature.bin


More information about the Mod_python mailing list