durusmail: quixote-users: Demo code for upload.cgi seems obsolete
Demo code for upload.cgi seems obsolete
2004-10-24
2004-10-24
Demo code for upload.cgi seems obsolete
Rob Pawsner
2004-10-24
Hello from Los Angeles; I'm a new subscriber to this list. I'm baffled by
several discrepancies in the supplied demo code. In "CHANGES", I see this --
  2.0a1 (2004-10-14) r25357:

    Remove obsolete functions from 'html' module (html_quote()  [...]
Also, in "http_request.py", I can see that an Upload object has a small number
of attributes, none of which is the received file's name -- though that's
available indirectly via the "fp" attribute. In particular, there is no
attribute "tmp_filename".

But the code in demo/upload.cgi, excerpted below, contradicts both these points,
so it can't be executed, or even validated. My question is, am I somehow
downloading or looking at the wrong code? I have diagnosed and fixed the
apparent problems in "upload.cgi", but I'm beginning to see similar anomalies in
other demo files, and I thought I'd better ask now.

-- Rob Pawsner, Software Consultant, Los Angeles


--------------------------------------------------------------------------------

  def receive (request):
      result = []
      name = request.form.get("name")
      if name:
          result.append("

Thanks, %s!

" % html_quote(name)) upload = request.form.get("upload") size = os.stat(upload.tmp_filename)[stat.ST_SIZE]
reply