From davidism at gmail.com Wed Nov 8 16:00:47 2017 From: davidism at gmail.com (David Lord) Date: Wed, 8 Nov 2017 13:00:47 -0800 Subject: [Flask] Jinja 2.10 released Message-ID: We've released Jinja 2.10! https://github.com/pallets/jinja/releases/tag/2.10 Major changes include: - A `NativeEnvironment` that renders Python types instead of strings. http://jinja.pocoo.org/docs/2.10/nativetypes/ - A `namespace` object that works with `{% set %}`. This replaces previous hacks for storing state across iterations or scopes. http://jinja.pocoo.org/docs/2.10/templates/#assignments - The `loop` object now has `nextitem` and `previtem` attributes, as well as a `changed` method, for the common case of outputting something as a value in the loop changes. More complicated cases can use the `namespace` object. http://jinja.pocoo.org/docs/2.10/templates/#for Install or upgrade with pip: pip install -U Jinja2 ## Changelog - Added a new extension node called `OverlayScope` which can be used to create an unoptimized scope that will look up all variables from a derived context. - Added an `in` test that works like the in operator. This can be used in combination with `reject` and `select`. - Added `previtem` and `nextitem` to loop contexts, providing access to the previous/next item in the loop. If such an item does not exist, the value is undefined. - Added ``changed(*values)`` to loop contexts, providing an easy way of checking whether a value has changed since the last iteration (or rather since the last call of the method) - Added a `namespace` function that creates a special object which allows attribute assignment using the `set` tag. This can be used to carry data across scopes, e.g. from a loop body to code that comes after the loop. - Added a `trimmed` modifier to ``{% trans %}`` to strip linebreaks and surrounding whitespace. Also added a new policy to enable this for all `trans` blocks. - The `random` filter is no longer incorrectly constant folded and will produce a new random choice each time the template is rendered. (#478) - Added a `unique` filter. (#469) - Added `min` and `max` filters. (#475) - Added tests for all comparison operators: `eq`, `ne`, `lt`, `le`, `gt`, `ge`. (#665) - `import` statement cannot end with a trailing comma. (#617, #618) - `indent` filter will not indent blank lines by default. (#685) - Add `reverse` argument for `dictsort` filter. (#692) - Add a `NativeEnvironment` that renders templates to native Python types instead of strings. (#708) - Added filter support to the block `set` tag. (#489) - `tojson` filter marks output as safe to match documented behavior. (#718) - Resolved a bug where getting debug locals for tracebacks could modify template context. - Fixed a bug where having many ``{% elif ... %}`` blocks resulted in a "too many levels of indentation" error. These blocks now compile to native ``elif ..:`` instead of ``else: if ..:`` (#759) --- Finally, if you want to, please retweet this to spread the word to more developers: https://twitter.com/davidism/status/928359324904169473 Thank you to the community for your continued support and contributions! From AKumar at intrexon.com Wed Nov 15 12:54:54 2017 From: AKumar at intrexon.com (Kumar, Abhinav) Date: Wed, 15 Nov 2017 17:54:54 +0000 Subject: [Flask] Serving a file to download AND print message on screen Message-ID: Hi, After I process some data, I want to write log output to the screen and let user download the results as a zip file. I tried flash, but that does not print message until the app is executed next time. I can't possible use two return statements (one for send_file for download and other for rendering a template). I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'... In my template file I have code like Please download the result here And I place the results.zip file in "upload" folder before calling render_template. But the app says "The requested URL was not found on the server" The URL it points to is "http://akumar-linux2:5000/upload/results.zip" Thanks, Abhinav ________________________________ CONFIDENTIAL TRANSMISSION - To the extent this electronic communication or any of its attachments contain information that is not in the public domain, such information is considered by Intrexon Corporation to be confidential and proprietary. This communication is expected to be read and/or used only by the individual(s) for whom it is intended. If you have received this electronic communication in error, please reply to the sender advising of the error in transmission and delete the original message and any accompanying documents from your system immediately, without copying, reviewing or otherwise using them for any purpose. Thank you for your cooperation. -------------- next part -------------- An HTML attachment was scrubbed... URL: From AKumar at intrexon.com Wed Nov 15 12:47:19 2017 From: AKumar at intrexon.com (Kumar, Abhinav) Date: Wed, 15 Nov 2017 17:47:19 +0000 Subject: [Flask] Serving a file to downalod AND print message on screen Message-ID: <2B3DFC62F5B8E24886974202D106EE81FC9B3576@VA01-MBX-02.corp.intrexon.local> Hi, After I process some data, I want to write log output to the screen and let user download the results as a zip file. I tried flash, but that does not print message until the app is executed next time. I can't possible use two return statements (one for send_file for download and other for rendering a template). I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'... In my template file I have code like Please download the result here And I place the results.zip file in "upload" folder before calling render_template. But the app says "The requested URL was not found on the server" The URL it points to is "http://akumar-linux2:5000/upload/results.zip" Thanks, Abhinav ________________________________ CONFIDENTIAL TRANSMISSION - To the extent this electronic communication or any of its attachments contain information that is not in the public domain, such information is considered by Intrexon Corporation to be confidential and proprietary. This communication is expected to be read and/or used only by the individual(s) for whom it is intended. If you have received this electronic communication in error, please reply to the sender advising of the error in transmission and delete the original message and any accompanying documents from your system immediately, without copying, reviewing or otherwise using them for any purpose. Thank you for your cooperation. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stappers at stappers.nl Thu Nov 16 15:16:10 2017 From: stappers at stappers.nl (Geert Stappers) Date: Thu, 16 Nov 2017 21:16:10 +0100 Subject: [Flask] Serving a file to downalod AND print message on screen In-Reply-To: <2B3DFC62F5B8E24886974202D106EE81FC9B3576@VA01-MBX-02.corp.intrexon.local> References: <2B3DFC62F5B8E24886974202D106EE81FC9B3576@VA01-MBX-02.corp.intrexon.local> Message-ID: <20171116201610.GX21385@gpm.stappers.nl> On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote: > Hi, > > After I process some data, I want to write log output to the screen and let user download the results as a zip file. > > I tried flash, but that does not print message until the app is executed next time. > > I can't possible use two return statements (one for send_file for download and other for rendering a template). > > I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'... > > In my template file I have code like > Please download the result here > And I place the results.zip file in "upload" folder before calling render_template. > > But the app says "The requested URL was not found on the server" > The URL it points to is "http://akumar-linux2:5000/upload/results.zip" > FWIW I read above _two_ problems: * URL not found * wanting to write to screen Advice: Start with fixing the "URL not found". Groeten Geert Stappers Seen both postings from original poster, replying on one. -- Leven en laten leven From sidwoodstock at gmail.com Tue Nov 21 12:35:49 2017 From: sidwoodstock at gmail.com (sidwoodstock .) Date: Tue, 21 Nov 2017 09:35:49 -0800 Subject: [Flask] Serving a file to downalod AND print message on screen Message-ID: Just some thoughts: - Verify file is truly placed in /uploads/ - Verify your file server is exposing your uploads directory. - You can move around the code in your template which shows flashed messages, perhaps move it to a place which gets called when you want. To truly help with the uploads / file not found issue, it'd be helpful to know what other packages you're using. Scott Woodstock On Fri, Nov 17, 2017 at 9:00 AM, wrote: > Send Flask mailing list submissions to > flask at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/flask > or, via email, send a message with subject or body 'help' to > flask-request at python.org > > You can reach the person managing the list at > flask-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Flask digest..." > > > Today's Topics: > > 1. Re: Serving a file to downalod AND print message on screen > (Geert Stappers) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 16 Nov 2017 21:16:10 +0100 > From: Geert Stappers > To: flask at python.org > Subject: Re: [Flask] Serving a file to downalod AND print message on > screen > Message-ID: <20171116201610.GX21385 at gpm.stappers.nl> > Content-Type: text/plain; charset=us-ascii > > On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote: > > Hi, > > > > After I process some data, I want to write log output to the screen and > let user download the results as a zip file. > > > > I tried flash, but that does not print message until the app is executed > next time. > > > > I can't possible use two return statements (one for send_file for > download and other for rendering a template). > > > > I could use only template rendering and provide a link to download the > results file in the template html file, but that link says 'file not > found'... > > > > In my template file I have code like > > Please download the result here > > And I place the results.zip file in "upload" folder before calling > render_template. > > > > But the app says "The requested URL was not found on the server" > > The URL it points to is "http://akumar-linux2:5000/upload/results.zip" > > > > FWIW I read above _two_ problems: > * URL not found > * wanting to write to screen > > > Advice: Start with fixing the "URL not found". > > > > > > Groeten > Geert Stappers > Seen both postings from original poster, replying on one. > -- > Leven en laten leven > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > > ------------------------------ > > End of Flask Digest, Vol 29, Issue 3 > ************************************ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From AKumar at intrexon.com Tue Nov 21 14:30:02 2017 From: AKumar at intrexon.com (Kumar, Abhinav) Date: Tue, 21 Nov 2017 19:30:02 +0000 Subject: [Flask] Serving a file to downalod AND print message on screen In-Reply-To: References: Message-ID: <2B3DFC62F5B8E24886974202D106EE81FC9C3A60@VA01-MBX-02.corp.intrexon.local> Thanks for your thoughts. I can serve the file if I put it in 'static' folder, but not in 'upload' folder. I guess 'static' is exposed by default. I am not sure how to expose any other folder like 'upload'. Thanks, Abhinav ________________________________ From: Flask [flask-bounces+akumar=intrexon.com at python.org] on behalf of sidwoodstock . [sidwoodstock at gmail.com] Sent: Tuesday, November 21, 2017 9:35 AM To: flask at python.org Subject: Re: [Flask] Serving a file to downalod AND print message on screen Just some thoughts: - Verify file is truly placed in /uploads/ - Verify your file server is exposing your uploads directory. - You can move around the code in your template which shows flashed messages, perhaps move it to a place which gets called when you want. To truly help with the uploads / file not found issue, it'd be helpful to know what other packages you're using. Scott Woodstock On Fri, Nov 17, 2017 at 9:00 AM, > wrote: Send Flask mailing list submissions to flask at python.org To subscribe or unsubscribe via the World Wide Web, visit https://mail.python.org/mailman/listinfo/flask or, via email, send a message with subject or body 'help' to flask-request at python.org You can reach the person managing the list at flask-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Flask digest..." Today's Topics: 1. Re: Serving a file to downalod AND print message on screen (Geert Stappers) ---------------------------------------------------------------------- Message: 1 Date: Thu, 16 Nov 2017 21:16:10 +0100 From: Geert Stappers > To: flask at python.org Subject: Re: [Flask] Serving a file to downalod AND print message on screen Message-ID: <20171116201610.GX21385 at gpm.stappers.nl> Content-Type: text/plain; charset=us-ascii On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote: > Hi, > > After I process some data, I want to write log output to the screen and let user download the results as a zip file. > > I tried flash, but that does not print message until the app is executed next time. > > I can't possible use two return statements (one for send_file for download and other for rendering a template). > > I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'... > > In my template file I have code like > Please download the result here > And I place the results.zip file in "upload" folder before calling render_template. > > But the app says "The requested URL was not found on the server" > The URL it points to is "http://akumar-linux2:5000/upload/results.zip" > FWIW I read above _two_ problems: * URL not found * wanting to write to screen Advice: Start with fixing the "URL not found". Groeten Geert Stappers Seen both postings from original poster, replying on one. -- Leven en laten leven ------------------------------ Subject: Digest Footer _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask ------------------------------ End of Flask Digest, Vol 29, Issue 3 ************************************ ________________________________ CONFIDENTIAL TRANSMISSION - To the extent this electronic communication or any of its attachments contain information that is not in the public domain, such information is considered by Intrexon Corporation to be confidential and proprietary. This communication is expected to be read and/or used only by the individual(s) for whom it is intended. If you have received this electronic communication in error, please reply to the sender advising of the error in transmission and delete the original message and any accompanying documents from your system immediately, without copying, reviewing or otherwise using them for any purpose. Thank you for your cooperation. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ub at artfacts.net Wed Nov 22 08:07:22 2017 From: ub at artfacts.net (Ulrich Berthold) Date: Wed, 22 Nov 2017 14:07:22 +0100 Subject: [Flask] Serving a file to downalod AND print message on screen In-Reply-To: <2B3DFC62F5B8E24886974202D106EE81FC9C3A60@VA01-MBX-02.corp.intrexon.local> References: <2B3DFC62F5B8E24886974202D106EE81FC9C3A60@VA01-MBX-02.corp.intrexon.local> Message-ID: <20171122130722.GA20260@localhost> hey abhinav, On Tue, Nov 21, 2017 at 07:30:02PM +0000, Kumar, Abhinav wrote: > Thanks for your thoughts. > > I can serve the file if I put it in 'static' folder, but not in 'upload' folder. > I guess 'static' is exposed by default. > I am not sure how to expose any other folder like 'upload'. did you have a look at the fileupload pattern? http://flask.pocoo.org/docs/0.12/patterns/fileuploads/ it does exactly what you want, upload a file to a configurable upload folder and consequently serve the file from that location. hope that helps .. all the best, ub > Thanks, > Abhinav > > > ________________________________ > From: Flask [flask-bounces+akumar=intrexon.com at python.org] on behalf of sidwoodstock . [sidwoodstock at gmail.com] > Sent: Tuesday, November 21, 2017 9:35 AM > To: flask at python.org > Subject: Re: [Flask] Serving a file to downalod AND print message on screen > > Just some thoughts: > > - Verify file is truly placed in /uploads/ > - Verify your file server is exposing your uploads directory. > - You can move around the code in your template which shows flashed messages, perhaps move it to a place which gets called when you want. > > To truly help with the uploads / file not found issue, it'd be helpful to know what other packages you're using. > > > Scott Woodstock > > > > On Fri, Nov 17, 2017 at 9:00 AM, > wrote: > Send Flask mailing list submissions to > flask at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/flask > or, via email, send a message with subject or body 'help' to > flask-request at python.org > > You can reach the person managing the list at > flask-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Flask digest..." > > > Today's Topics: > > 1. Re: Serving a file to downalod AND print message on screen > (Geert Stappers) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 16 Nov 2017 21:16:10 +0100 > From: Geert Stappers > > To: flask at python.org > Subject: Re: [Flask] Serving a file to downalod AND print message on > screen > Message-ID: <20171116201610.GX21385 at gpm.stappers.nl> > Content-Type: text/plain; charset=us-ascii > > On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote: > > Hi, > > > > After I process some data, I want to write log output to the screen and let user download the results as a zip file. > > > > I tried flash, but that does not print message until the app is executed next time. > > > > I can't possible use two return statements (one for send_file for download and other for rendering a template). > > > > I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'... > > > > In my template file I have code like > > Please download the result here > > And I place the results.zip file in "upload" folder before calling render_template. > > > > But the app says "The requested URL was not found on the server" > > The URL it points to is "http://akumar-linux2:5000/upload/results.zip" > > > > FWIW I read above _two_ problems: > * URL not found > * wanting to write to screen > > > Advice: Start with fixing the "URL not found". > > > > > > Groeten > Geert Stappers > Seen both postings from original poster, replying on one. > -- > Leven en laten leven > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > > ------------------------------ > > End of Flask Digest, Vol 29, Issue 3 > ************************************ > > > ________________________________ > > CONFIDENTIAL TRANSMISSION - To the extent this electronic communication or any of its attachments contain information that is not in the public domain, such information is considered by Intrexon Corporation to be confidential and proprietary. This communication is expected to be read and/or used only by the individual(s) for whom it is intended. If you have received this electronic communication in error, please reply to the sender advising of the error in transmission and delete the original message and any accompanying documents from your system immediately, without copying, reviewing or otherwise using them for any purpose. Thank you for your cooperation. > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From AKumar at intrexon.com Wed Nov 22 12:24:29 2017 From: AKumar at intrexon.com (Kumar, Abhinav) Date: Wed, 22 Nov 2017 17:24:29 +0000 Subject: [Flask] Serving a file to downalod AND print message on screen In-Reply-To: <20171122130722.GA20260@localhost> References: <2B3DFC62F5B8E24886974202D106EE81FC9C3A60@VA01-MBX-02.corp.intrexon.local> <20171122130722.GA20260@localhost> Message-ID: <197DA209-8B47-43B3-9C28-9BE8B24F1858@intrexon.com> Thanks UB. This URL explains how to upload file. For allowing users to download result (which I want), it uses send_from_directory function as a return statement. This prevents me from printing information on the screen before download. As I found out, I can render the information to be printed through a template html file wherein I also provide a link to download the file. My template html has code like: "Download result here Other information goes here... " Thanks, Abhinav On Nov 22, 2017, at 5:07 AM, Ulrich Berthold > wrote: hey abhinav, On Tue, Nov 21, 2017 at 07:30:02PM +0000, Kumar, Abhinav wrote: Thanks for your thoughts. I can serve the file if I put it in 'static' folder, but not in 'upload' folder. I guess 'static' is exposed by default. I am not sure how to expose any other folder like 'upload'. did you have a look at the fileupload pattern? http://flask.pocoo.org/docs/0.12/patterns/fileuploads/ it does exactly what you want, upload a file to a configurable upload folder and consequently serve the file from that location. hope that helps .. all the best, ub Thanks, Abhinav ________________________________ From: Flask [flask-bounces+akumar=intrexon.com at python.org] on behalf of sidwoodstock . [sidwoodstock at gmail.com] Sent: Tuesday, November 21, 2017 9:35 AM To: flask at python.org Subject: Re: [Flask] Serving a file to downalod AND print message on screen Just some thoughts: - Verify file is truly placed in /uploads/ - Verify your file server is exposing your uploads directory. - You can move around the code in your template which shows flashed messages, perhaps move it to a place which gets called when you want. To truly help with the uploads / file not found issue, it'd be helpful to know what other packages you're using. Scott Woodstock On Fri, Nov 17, 2017 at 9:00 AM, > wrote: Send Flask mailing list submissions to flask at python.org To subscribe or unsubscribe via the World Wide Web, visit https://mail.python.org/mailman/listinfo/flask or, via email, send a message with subject or body 'help' to flask-request at python.org You can reach the person managing the list at flask-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Flask digest..." Today's Topics: 1. Re: Serving a file to downalod AND print message on screen (Geert Stappers) ---------------------------------------------------------------------- Message: 1 Date: Thu, 16 Nov 2017 21:16:10 +0100 From: Geert Stappers > To: flask at python.org Subject: Re: [Flask] Serving a file to downalod AND print message on screen Message-ID: <20171116201610.GX21385 at gpm.stappers.nl> Content-Type: text/plain; charset=us-ascii On Wed, Nov 15, 2017 at 05:47:19PM +0000, Kumar, Abhinav wrote: Hi, After I process some data, I want to write log output to the screen and let user download the results as a zip file. I tried flash, but that does not print message until the app is executed next time. I can't possible use two return statements (one for send_file for download and other for rendering a template). I could use only template rendering and provide a link to download the results file in the template html file, but that link says 'file not found'... In my template file I have code like Please download the result here And I place the results.zip file in "upload" folder before calling render_template. But the app says "The requested URL was not found on the server" The URL it points to is "http://akumar-linux2:5000/upload/results.zip" FWIW I read above _two_ problems: * URL not found * wanting to write to screen Advice: Start with fixing the "URL not found". Groeten Geert Stappers Seen both postings from original poster, replying on one. -- Leven en laten leven ------------------------------ Subject: Digest Footer _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask ------------------------------ End of Flask Digest, Vol 29, Issue 3 ************************************ ________________________________ CONFIDENTIAL TRANSMISSION - To the extent this electronic communication or any of its attachments contain information that is not in the public domain, such information is considered by Intrexon Corporation to be confidential and proprietary. This communication is expected to be read and/or used only by the individual(s) for whom it is intended. If you have received this electronic communication in error, please reply to the sender advising of the error in transmission and delete the original message and any accompanying documents from your system immediately, without copying, reviewing or otherwise using them for any purpose. Thank you for your cooperation. _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From rrr at onionmail.info Wed Nov 29 21:31:00 2017 From: rrr at onionmail.info (rrr) Date: Thu, 30 Nov 2017 02:31:00 +0000 Subject: [Flask] OK In-Reply-To: References: Message-ID: OK From rrr at onionmail.info Wed Nov 29 21:46:00 2017 From: rrr at onionmail.info (rrr) Date: Thu, 30 Nov 2017 02:46:00 +0000 Subject: [Flask] restless In-Reply-To: <7cc423fb382691a911f3b96daa8ca182@pysecure.io> References: <7cc423fb382691a911f3b96daa8ca182@pysecure.io> Message-ID: > Have a great weekend everybody you too, bro!