durusmail: quixote-users: Strategies for returning file contents *and* HTML...
Strategies for returning file contents *and* HTML...
Strategies for returning file contents *and* HTML...
2004-03-12
2004-03-12
Strategies for returning file contents *and* HTML...
Stuart Hungerford
2004-03-12
Hi all,

I have a question that's part Quixote usage and part web
application design issue.  I also suspect the answer to my
question is something like "No. HTTP is a stateless
protocol. Go and RTFM the RFC."

As I mentioned in an earlier post I have a class that
serves up the contents of a file:


class filenameUI(object):
     def __init__(self, filename):
         self.filename = filename

     def _q_index(self, request):
         if can_publish(self.filename):
             the_file = StaticFile(self.filename)
             return the_file(request)
         else:
             return "Sorry, that file not available"

     __call__ = _q_index



What I'd like is some scheme that lets me issue a
"now downloading your file" HTML page *and then*
return the contents of StaticFile like:

...
     def _q_index(self, request):
         if can_publish(self.filename):
             "Now downloading your file"
             the_file = StaticFile(self.filename)
             return the_file(request)
         else:
             return "Sorry, that file not available"


But I think this constitutes two replies to one request
and assumes HTTP keeps request state?

How do Quixote users handle this kind of requirement in
practice?  I can see one way would be to have separate
URLs for the message and the download and have the
message HTML do a  "refresh" call back to the download
URL?

Cheers,

Stu

--
:: Stuart Hungerford (stuart.hungerford@anu.edu.au)
:: ANU Internet Futures Group



reply