Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'pop': 0.05; 'subject:file': 0.07; "client's": 0.09; 'identifier': 0.09; 'invalidate': 0.09; 'window.': 0.09; 'runs': 0.10; 'subject:How': 0.10; 'python': 0.11; '"%s"': 0.16; 'form"': 0.16; 'identifiers': 0.16; 'link,': 0.16; 'subject:after': 0.16; 'subject:download': 0.16; 'to:name:python list': 0.16; 'valid.': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'file,': 0.19; 'help.': 0.21; 'print': 0.22; 'load': 0.23; 'file.': 0.24; '---': 0.24; 'script': 0.25; '>': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; '----': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'requests': 0.31; 'cgi': 0.31; 'sep': 0.31; 'allows': 0.31; 'file': 0.32; 'figure': 0.32; 'another': 0.32; 'open': 0.33; 'problem': 0.35; 'received:209.85': 0.35; 'problem.': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'received:209': 0.37; 'button': 0.38; 'skip:& 10': 0.38; 'form,': 0.38; 'stopped': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'track': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'browser': 0.61; "you'll": 0.62; 'such': 0.63; 'choose': 0.64; 'close': 0.67; 'click': 0.77; 'download.': 0.91; 'opens': 0.91; '2013': 0.98 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=EnS747gv3PpCf1S0Dk2JNpYYTgdqlFmfcGblkjAj2TI=; b=e/gyaC7xTmMfrFblDrzSK9nV8NIXzTSftLMxumcrazh7LqkeymKyD0cvev+A6PELkb DW3ephen9xtp6uuWxmmW/I5rYBInj2cIvGt3n1hmiJshuZovtUVCtSuPvIaZBKFYTiDa iJ7TS+CTVfJ8U9U7v3f4S4RZanXPzFWHvaUqO4OYhNHohpyDfUBh1K32dZf+CFU91RGM BgmSnDpqveJf4pSXMdRgbhc/h+GsJti1gpgdZCpQNL8BelrXMGSFvHcdpReSGiSCiyqs 5GdnRTFvSnYA20i/CTadG5KOyJHlARIleUz4KI/qJdipVKGdMJ3sM6QwUlzRMLTcQzjW CAew== X-Gm-Message-State: ALoCoQkRkF8qOIJbtNHKaQv+7NShtKBQwnVWhJZ4FT2VLMKLJeU3HPuX7yzdGPdPzdCtX5mu/GyVir3HXhapQhcINtkeA3ypQZbIi7QmzIZRe647JjGUg28XORnvhqRODTdsJ/7HAb62uZqgf0pL25mARvMBTYkv3g== X-Received: by 10.182.24.105 with SMTP id t9mr3626399obf.86.1378327860713; Wed, 04 Sep 2013 13:51:00 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.24.105 with SMTP id t9mr3626393obf.86.1378327860616; Wed, 04 Sep 2013 13:51:00 -0700 (PDT) In-Reply-To: <4159689.hlvflXlB94@mach-123> References: <4159689.hlvflXlB94@mach-123> Date: Wed, 4 Sep 2013 13:51:00 -0700 Subject: Re: How to exit a cgi file after a download From: Benjamin Kaplan To: Python List Content-Type: multipart/alternative; boundary=001a11c2a33084348e04e594f6d6 X-Junkmail-Whitelist: YES (by domain whitelist at mpv2.tis.cwru.edu) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 108 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378328245 news.xs4all.nl 15871 [2001:888:2000:d::a6]:38663 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53652 --001a11c2a33084348e04e594f6d6 Content-Type: text/plain; charset=UTF-8 On Sep 4, 2013 1:29 PM, "Ferrous Cranus" wrote: > > Python help. > > I use the following code in a cgi file > to give the client a download link to > download a file. > > --- > > print "%s" % (' Down > Load ') > > ---- > > A click on "Down Load" opens a pop up browser > window which allows the user to choose where > to download the "Setup.zip" file, then after > the download, the pop up window closes. > > My problem is that I want the cgi form, which > contains the link, to also close after the > download. The only way I can figure out to > close the cgi window is to give the user a > button to close it. > > Without closing it, the client can download > again and forever if they choose to because > the cgi window is open and the link is still > active. > > I am trying to find a way to close the cgi > file or call another file after the download > without adding a close button and asking the > client to close the window. > > jd > > There is no such thing as a "cgi form" or "cgi window". Your cgi script runs when the user requests a Web page, generates a page, and then ends. At that point, python has stopped running. If your want the client's browser window to close, that's not a python problem. If you want to invalidate the download link after one successful download, you'll have to add a unique identifier to the url and keep track of which identifiers are still valid. --001a11c2a33084348e04e594f6d6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Sep 4, 2013 1:29 PM, "Ferrous Cranus" <nikos@superhost.gr> wrote:
>
> Python help.
>
> I use the following code in a cgi file
> to give the client a download link to
> download a file.
>
> ---
>
> print "%s" % ('<a href =3D "Setup.zip"> = Down
> Load </a>')
>
> ----
>
> A click on "Down Load" opens a pop up browser
> window which allows the user to choose where
> to download the "Setup.zip" file, then after
> the download, the pop up window closes.
>
> My problem is that I want the cgi form, which
> contains the link, to also close after the
> download. =C2=A0The only way I can figure out to
> close the cgi window is to give the user a
> button to close it.
>
> Without closing it, the client can download
> again and forever if they choose to because
> the cgi window is open and the link is still
> active.
>
> I am trying to find a way to close the cgi
> file or call another file after the download
> without adding a close button and asking the
> client to close the window.
>
> jd
>
>

There is no such thing as a "cgi form" or "cg= i window". Your cgi script runs when the user requests a Web page, gen= erates a page, and then ends. At that point, python has stopped running. If= your want the client's browser window to close, that's not a pytho= n problem. If you want to invalidate the download link after one successful= download, you'll have to add a unique identifier to the url and keep t= rack of which identifiers are still valid.

--001a11c2a33084348e04e594f6d6--