From ZDunlap at ap.org Wed Dec 2 12:07:22 2015 From: ZDunlap at ap.org (Dunlap, Zachariah) Date: Wed, 2 Dec 2015 17:07:22 +0000 Subject: [Flask] Trying to pass XML through to an HTML template Message-ID: Hi all, I'm sure I'm missing something but I haven't had any luck figuring out what, perhaps someone here can point me in the right direction. I have the module below which I'm using to get and XML item from a URL, read it and return elements and values to an HTML template. The itemid and description variables render in the template just fine, the one that I'm having an issue with is the XML I need to send through to a textarea on the template. I've tried rendering it as a string, escaping it & encoding it but have had no luck getting it passed through. I've tested getting this XML in a simple module and I know it returns content but the module for this applicattion can't see that value, it comes back as 'None'. Any guidance on how I can pass XML through to the textarea would be greatly appreciated. MODULE: @app.route('/updateitem', methods=['GET']) def updateitem(): url = 'http://xmldocument.fake' url_request = requests.get(url) root = etree.fromstring(url_request.text) itemid = root.xpath('//main/@id') description = root.xpath('//main/text()') xmlitem = root.xpath('//ns:XmlItem', namespaces={'ns': 'http://fakenamespace.com'}) # return render_template('create-definitions.html', itemid=itemid, name=name, description=description, xmlitem=xmlitem) return render_template('create-definitions.html', **locals()) TEXTAREA NEEDING THE XML: Thanks, Zach The information contained in this communication is intended for the use of the designated recipients named above. If the reader of this communication is not the intended recipient, you are hereby notified that you have received this communication in error, and that any review, dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify The Associated Press immediately by telephone at +1-212-621-1898 and delete this email. Thank you. [IP_US_DISC] msk dccc60c6d2c3a6438f0cf467d9a4938 -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidism at gmail.com Wed Dec 2 12:27:11 2015 From: davidism at gmail.com (David Lord) Date: Wed, 2 Dec 2015 09:27:11 -0800 Subject: [Flask] Trying to pass XML through to an HTML template In-Reply-To: References: Message-ID: <565F29EF.8020907@gmail.com> You passed `xmlitem` in `render_template`, so it's not clear why you're trying to access it from `request.args`. Since it's an etree node, you'll need to call [`.toString`][1] on it to convert it first. Reference it as the variable you passed to the context: `{{ xmlitem.toString() }}`. [1]: https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.tostring On 12/02/2015 09:07 AM, Dunlap, Zachariah wrote: > Hi all, > > I?m sure I?m missing something but I haven?t had any luck figuring out > what, perhaps someone here can point me in the right direction. > > I have the module below which I?m using to get and XML item from a URL, > read it and return elements and values to an HTML template. > > The itemid and description variables render in the template just fine, > the one that I?m having an issue with is the XML I need to send through > to a textarea on the template. I?ve tried rendering it as a string, > escaping it & encoding it but have had no luck getting it passed through. > > I?ve tested getting this XML in a simple module and I know it returns > content but the module for this applicattion can?t see that value, it > comes back as ?None?. > > Any guidance on how I can pass XML through to the textarea would be > greatly appreciated. > > MODULE: > > @app.route('/updateitem', methods=['GET']) > > def updateitem(): > > url = 'http://xmldocument.fake' > > url_request = requests.get(url) > > root = etree.fromstring(url_request.text) > > itemid = root.xpath('//main/@id') > > description = root.xpath('//main/text()') > > xmlitem = root.xpath('//ns:XmlItem', namespaces={'ns': > 'http://fakenamespace.com'}) > > # return render_template('create-definitions.html', itemid=itemid, > name=name, description=description, xmlitem=xmlitem) > > return render_template('create-definitions.html', **locals()) > > TEXTAREA NEEDING THE XML: > > > > Thanks, > > > Zach > > The information contained in this communication is intended for the use > of the designated recipients named above. If the reader of this > communication is not the intended recipient, you are hereby notified > that you have received this communication in error, and that any review, > dissemination, distribution or copying of this communication is strictly > prohibited. If you have received this communication in error, please > notify The Associated Press immediately by telephone at +1-212-621-1898 > and delete this email. Thank you. > [IP_US_DISC] > > > msk dccc60c6d2c3a6438f0cf467d9a4938 > > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > From ZDunlap at ap.org Wed Dec 2 12:48:32 2015 From: ZDunlap at ap.org (Dunlap, Zachariah) Date: Wed, 2 Dec 2015 17:48:32 +0000 Subject: [Flask] Trying to pass XML through to an HTML template In-Reply-To: <565F29EF.8020907@gmail.com> References: <565F29EF.8020907@gmail.com> Message-ID: Thanks David, I did try stringfying the variable before but didn't realize I could just call it without needing to use request.args. This is certainly a learning experience. Appreciate you answering so quickly Best, Zach -----Original Message----- From: Flask [mailto:flask-bounces+zdunlap=ap.org at python.org] On Behalf Of David Lord Sent: Wednesday, December 02, 2015 12:27 PM To: flask at python.org Subject: Re: [Flask] Trying to pass XML through to an HTML template You passed `xmlitem` in `render_template`, so it's not clear why you're trying to access it from `request.args`. Since it's an etree node, you'll need to call [`.toString`][1] on it to convert it first. Reference it as the variable you passed to the context: `{{ xmlitem.toString() }}`. [1]: https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.tostring On 12/02/2015 09:07 AM, Dunlap, Zachariah wrote: > Hi all, > > I?m sure I?m missing something but I haven?t had any luck figuring out > what, perhaps someone here can point me in the right direction. > > I have the module below which I?m using to get and XML item from a > URL, read it and return elements and values to an HTML template. > > The itemid and description variables render in the template just fine, > the one that I?m having an issue with is the XML I need to send > through to a textarea on the template. I?ve tried rendering it as a > string, escaping it & encoding it but have had no luck getting it passed through. > > I?ve tested getting this XML in a simple module and I know it returns > content but the module for this applicattion can?t see that value, it > comes back as ?None?. > > Any guidance on how I can pass XML through to the textarea would be > greatly appreciated. > > MODULE: > > @app.route('/updateitem', methods=['GET']) > > def updateitem(): > > url = 'http://xmldocument.fake' > > url_request = requests.get(url) > > root = etree.fromstring(url_request.text) > > itemid = root.xpath('//main/@id') > > description = root.xpath('//main/text()') > > xmlitem = root.xpath('//ns:XmlItem', namespaces={'ns': > 'http://fakenamespace.com'}) > > # return render_template('create-definitions.html', > itemid=itemid, name=name, description=description, xmlitem=xmlitem) > > return render_template('create-definitions.html', **locals()) > > TEXTAREA NEEDING THE XML: > > > > Thanks, > > > Zach > > The information contained in this communication is intended for the > use of the designated recipients named above. If the reader of this > communication is not the intended recipient, you are hereby notified > that you have received this communication in error, and that any > review, dissemination, distribution or copying of this communication > is strictly prohibited. If you have received this communication in > error, please notify The Associated Press immediately by telephone at > +1-212-621-1898 and delete this email. Thank you. > [IP_US_DISC] > > > msk dccc60c6d2c3a6438f0cf467d9a4938 > > > > _______________________________________________ > 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 From ddwiggins at advpubtech.com Thu Dec 3 13:07:57 2015 From: ddwiggins at advpubtech.com (Don Dwiggins) Date: Thu, 3 Dec 2015 10:07:57 -0800 Subject: [Flask] Having troubles with template rendering in class-based routing In-Reply-To: References: Message-ID: OK, problem solved. in thrashing around, I added "defaults={'name': None}" to add_url_rule; this was causing the value in the URL to be ignored. A similar case is described at http://stackoverflow.com/questions/15421193/using-defaults-with-app-add-url-rule-in-flask. The lesson seems to be this: if you have a rule for "/Foo/", it won't match with a URL lacking a value to match "bar". To handle that case, you need to register another rule for "/Foo/", with a "defaults" parameter to give "bar" a value. Unfortunately, this isn't made very clear in either the Flask or Werkzeug documentation. On 11/25/15 12:56 PM, Don Dwiggins wrote: > I'm having trouble doing routing with class-based dispatching. > > In my url_map, I have a rule: "' (HEAD, OPTIONS, > GET) -> Home>". > > The view_func set to: >> self.RenderTemplateView.as_view( self.label, self.label+'.html', >> 'templates') > where self.label='Home', and there's a template in > "templates/Home.html" that renders differently depending on whether > has a value or is None. > > RenderTemplateView is defined as: >> class RenderTemplateView(flask.views.View): >> def __init__(self, template_name, *args, **kwargs): >> self.template_name = template_name >> >> def dispatch_request(self, *args, **kwargs): >> return flask.render_template(self.template_name) > > Call it with "http://127.0.0.1:5000/Home/thing" renders the template, > except that the variable is bound to None, not to "thing". If > I add "name='thing' " to the render_template call, it does get > included in the display. > > I've tried a number of things, including inserting a line "x = 1/0" > before the render_template call to get a traceback, then examining the > sequence of calls; I couldn't find anything helpful. > > Decorator-based routing works fine, but isn't an option for me. > > Any good words appreciated, > > > -- > Don Dwiggins > Advanced Publishing Technology > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at akwebsoft.com Tue Dec 8 18:40:48 2015 From: tim at akwebsoft.com (Tim Johnson) Date: Tue, 8 Dec 2015 14:40:48 -0900 Subject: [Flask] How to supress SQLALCHEMY_TRACK_MODIFICATIONS warning Message-ID: <20151208234048.GB12816@mail.akwebsoft.com> I'm getting the following warning : """ warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.') """ I find much chatter about this issue, but no example of specifically how to disable the warning. I have tried the following: ## Flask instantiation app = Flask(__name__) ## ... other config settings app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True ... But the warning persists. thanks in advance -- Tim http://www.akwebsoft.com, http://www.tj49.com From tim at akwebsoft.com Tue Dec 8 20:32:48 2015 From: tim at akwebsoft.com (Tim Johnson) Date: Tue, 8 Dec 2015 16:32:48 -0900 Subject: [Flask] How to supress SQLALCHEMY_TRACK_MODIFICATIONS warning In-Reply-To: <20151208234048.GB12816@mail.akwebsoft.com> References: <20151208234048.GB12816@mail.akwebsoft.com> Message-ID: <20151209013248.GA2977@mail.akwebsoft.com> * Tim Johnson [151208 14:46]: > I'm getting the following warning : > """ > warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant > overhead and will be disabled by default in the future. Set it to > True to suppress this warning.') > """ > > I find much chatter about this issue, but no example of > specifically how to disable the warning. > > I have tried the following: > ## Flask instantiation > app = Flask(__name__) > ## ... other config settings > app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True > > ... But the warning persists. I had a typo in the key name. I'm good now. And now I know I can reach this list. :) cheers -- Tim http://www.akwebsoft.com, http://www.tj49.com From jeff at jeffwidman.com Wed Dec 9 02:35:49 2015 From: jeff at jeffwidman.com (Jeff Widman) Date: Tue, 8 Dec 2015 23:35:49 -0800 Subject: [Flask] How to supress SQLALCHEMY_TRACK_MODIFICATIONS warning In-Reply-To: <20151209013248.GA2977@mail.akwebsoft.com> References: <20151208234048.GB12816@mail.akwebsoft.com> <20151209013248.GA2977@mail.akwebsoft.com> Message-ID: Welcome to the list Tim. Glad you figured it out. ? On Tue, Dec 8, 2015 at 5:32 PM, Tim Johnson wrote: > * Tim Johnson [151208 14:46]: > > I'm getting the following warning : > > """ > > warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant > > overhead and will be disabled by default in the future. Set it to > > True to suppress this warning.') > > """ > > > > I find much chatter about this issue, but no example of > > specifically how to disable the warning. > > > > I have tried the following: > > ## Flask instantiation > > app = Flask(__name__) > > ## ... other config settings > > app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True > > > > ... But the warning persists. > I had a typo in the key name. I'm good now. > And now I know I can reach this list. :) > cheers > -- > Tim > http://www.akwebsoft.com, http://www.tj49.com > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -- *Jeff Widman* jeffwidman.com | 740-WIDMAN-J (943-6265) <>< -------------- next part -------------- An HTML attachment was scrubbed... URL: From somenxavier at gmail.com Sun Dec 13 14:26:57 2015 From: somenxavier at gmail.com (Xavier) Date: Sun, 13 Dec 2015 20:26:57 +0100 Subject: [Flask] Babel tries... Message-ID: Hi, I have a simply app: # Imports from flask import Flask, jsonify, request, make_response, render_template, url_for, flash, redirect from yaml import load, dump try: from yaml import CLoader as Loader, CDumper as Dumper except ImportError: from yaml import Loader, Dumper from flask.ext.babel import Babel # Global variables version = "0.1" app = Flask(__name__) app.secret_key = 'el meu secret' # Babel settings app.config.from_pyfile('configuration.cfg') babel = Babel(app) LANGUAGES = { 'en': 'English', 'es': 'Espa?ol', 'ca': 'Catal?' } @babel.localeselector def get_locale(): return request.accept_languages.best_match(LANGUAGES.keys()) # Main procedure def create_new_activity(): """It creates a new activity after a POST request""" flash(request.form.get('name')) flash(request.form.get('body')) flash(request.form.getlist('tags')) return redirect(url_for('add_activity')) def show_new_activity_form(): """It shows a form for create a new activity""" return render_template('add_activity.html') @app.route("/add/", methods=['GET', 'POST']) def add_activity(): """Add a new activity to the collection""" if request.method == 'POST': return create_new_activity() else: return show_new_activity_form() if __name__ == "__main__": app.run(debug=True) My babel.cfg is [python: **.py] [jinja2: **/templates/**.html] extensions=jinja2.ext.autoescape,jinja2.ext.with_ and my configuration.cfg is BABEL_DEFAULT_LOCALE="en" When I run #!/usr/bin/env sh pybabel extract -F babel.cfg -o messages.pot templates/ pybabel init -i messages.pot -d translations -l ca pybabel init -i messages.pot -d translations -l en pybabel init -i messages.pot -d translations -l es pybabel compile -d translations I get EMPTY (nothing to be translated) files, although in my templates I have the base.html with words for translating: {% block title %}{% endblock %} ∈ Activiteca {% block css_js %} {% endblock %} {% block header %}
{% endblock %}
{% block content %}{% endblock %}
{% block footer %} {% endblock %} Any hints? Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidmontgomery at gmail.com Tue Dec 15 17:56:53 2015 From: davidmontgomery at gmail.com (David Montgomery) Date: Wed, 16 Dec 2015 06:56:53 +0800 Subject: [Flask] How to use flask auth with blueprints Message-ID: Hi, New to flask....and having issues with scaling the app. So I created a bluiprint and decorated with @login_required. Auth, Users etc are on my main views.py. If I remove @login_required my code works. But if I add I am redirected to login page. Auth does work prior to moving the code to a blueprint. So how do I import into my blueprint the objects needed for auth? Here is my blueprint from flask import Flask, render_template,request,jsonify,Responsefrom flask import make_response,session,redirect,url_for,gfrom flask.ext.security import Securityfrom flask.ext.login import login_user, logout_user, current_user, login_required, UserMixin,confirm_login,fresh_login_requiredfrom flask_security import auth_token_required, http_auth_requiredfrom passlib.apps import custom_app_context as pwd_contextfrom flask.ext.httpauth import HTTPBasicAuth # sudo pip install flask-httpauthfrom flask import Blueprint auth = HTTPBasicAuth() delstack = Blueprint('/delstack/', __name__)@delstack.route('/delstack/', methods=['DELETE'])@login_requireddef delstack_route(stack_id): jd = {'status':'ok'} data = json.dumps(jd) resp = Response(data, status=200, mimetype='application/json') return resp -------------- next part -------------- An HTML attachment was scrubbed... URL: From linnchord at gmail.com Wed Dec 16 00:39:29 2015 From: linnchord at gmail.com (linnchord) Date: Wed, 16 Dec 2015 05:39:29 +0000 Subject: [Flask] How to use flask auth with blueprints In-Reply-To: References: Message-ID: I don't get it. What do you want exactly? The @login_required is doing the right thing in your description. If you don't need this, you can remove it. If you need auth in you view handler only in some positions, you can do if not current_user.is_authenticated: return current_app.login_manager.unauthorized() Or, you can write a decorator you need, maybe @login_check. David Montgomery ?2015?12?16??? ??6:57??? > Hi, > > New to flask....and having issues with scaling the app. > > So I created a bluiprint and decorated with @login_required. Auth, Users > etc are on my main views.py. If I remove @login_required my code works. But > if I add I am redirected to login page. Auth does work prior to moving the > code to a blueprint. So how do I import into my blueprint the objects > needed for auth? > > Here is my blueprint > > from flask import Flask, render_template,request,jsonify,Responsefrom flask import make_response,session,redirect,url_for,gfrom flask.ext.security import Securityfrom flask.ext.login import login_user, logout_user, current_user, login_required, UserMixin,confirm_login,fresh_login_requiredfrom flask_security import auth_token_required, http_auth_requiredfrom passlib.apps import custom_app_context as pwd_contextfrom flask.ext.httpauth import HTTPBasicAuth # sudo pip install flask-httpauthfrom flask import Blueprint > auth = HTTPBasicAuth() > > delstack = Blueprint('/delstack/', __name__)@delstack.route('/delstack/', methods=['DELETE'])@login_requireddef delstack_route(stack_id): > > jd = {'status':'ok'} > data = json.dumps(jd) > resp = Response(data, status=200, mimetype='application/json') > return resp > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -- >> linnchord at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tamasiaina at gmail.com Fri Dec 18 18:03:00 2015 From: tamasiaina at gmail.com (Jonathan Chen) Date: Fri, 18 Dec 2015 15:03:00 -0800 Subject: [Flask] Request Only Attributes Security Question Message-ID: So I've been making an extension over the past six months that we are using internally at my company. So I've been running into a few issues here and there. The basic premise of the extension (more like a mini-framework) Is that it expose custom redis objects via a REST Api with some security. We use security tokens to authenticate for the REST API's, for a while I've been stuffing the token in _app_ctx_stack.top, but I've started to notice that the token sometimes persists beyond the first request. So I've been using an app.after_request() function to delete the token from _app_ctx_stack.top. Is this the best place to keep the token? Is there a chance I might run into any issues? (threading)? ~Jonathan C. -------------- next part -------------- An HTML attachment was scrubbed... URL: From klawlor419 at gmail.com Sun Dec 20 22:43:37 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Sun, 20 Dec 2015 22:43:37 -0500 Subject: [Flask] probably ssl-related, flask-googlemaps issue, on a heroku deploy Message-ID: Hi, all. I recently uploaded my web app onto Heroku. It is a site that I am making for a friends restaurant: lacasadelsabor.herokuapp.com The trouble is that I'm using *Flask-Googlemaps* to display the restaurant location, but the map does not load by default ( lacasadelsabor.herokuapp.com/maps). I've noticed that if I "disable protection for now" (in ubuntu firefox) the map does load. The map also loads fine when run locally with gunicorn. (I did not test locally with heroku yet). I'm using *Flask-SSLify* and that seems to be configured properly. (I've got it so that it triggers only when run in the Heroku) curl -I http://lacasadelsabor.herokuapp.com > > HTTP/1.1 302 FOUND > Connection: keep-alive > Server: gunicorn/19.4.1 > Date: Mon, 21 Dec 2015 03:29:47 GMT > Content-Type: text/html; charset=utf-8 > Content-Length: 281 > Location: https://lacasadelsabor.herokuapp.com/ > Via: 1.1 vegur > Additionally I am seeing an alert in firefox by the ssl-lock icon. Which says "firefox blocks parts of the page that are not are not secure". I'm sure that I am doing or missing something stupid. Any pointers on where I should go from here? Thanks for your time, Kyle -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidnieder at gmx.de Mon Dec 21 04:09:14 2015 From: davidnieder at gmx.de (David Nieder) Date: Mon, 21 Dec 2015 10:09:14 +0100 Subject: [Flask] probably ssl-related, flask-googlemaps issue, on a heroku deploy In-Reply-To: References: Message-ID: <5677C1BA.6080002@gmx.de> On 21.12.2015 04:43, Kyle Lawlor wrote: > Hi, all. > > I recently uploaded my web app onto Heroku. It is a site that I am making > for a friends restaurant: lacasadelsabor.herokuapp.com > > The trouble is that I'm using *Flask-Googlemaps* to display the restaurant > location, but the map does not load by default ( > lacasadelsabor.herokuapp.com/maps). I've noticed that if I "disable > protection for now" (in ubuntu firefox) the map does load. The map also > loads fine when run locally with gunicorn. (I did not test locally with > heroku yet). > > I'm using *Flask-SSLify* and that seems to be configured properly. (I've > got it so that it triggers only when run in the Heroku) > > curl -I http://lacasadelsabor.herokuapp.com >> >> HTTP/1.1 302 FOUND >> Connection: keep-alive >> Server: gunicorn/19.4.1 >> Date: Mon, 21 Dec 2015 03:29:47 GMT >> Content-Type: text/html; charset=utf-8 >> Content-Length: 281 >> Location: https://lacasadelsabor.herokuapp.com/ >> Via: 1.1 vegur >> > > Additionally I am seeing an alert in firefox by the ssl-lock icon. Which > says "firefox blocks parts of the page that are not are not secure". > The problem is that you tell the browser to load resources over http while your site was served over https. Modern browsers won't do that. I'm guessing that flask-googlemaps included those lines. The latest commit on github seems to deal with this issue. https://github.com/rochacbruno/Flask-GoogleMaps/commit/c7b5979684ff7bf11d90270a56bae44e461de9fb Try updating the extensions and check if you have version 0.1.9 installed. That probably solves this issue. If you've included urls yourself just change the url scheme to https or use relative schemes: > I'm sure that I am doing or missing something stupid. > Any pointers on where I should go from here? > > Thanks for your time, > Kyle > > > From klawlor419 at gmail.com Mon Dec 21 11:39:47 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Mon, 21 Dec 2015 11:39:47 -0500 Subject: [Flask] probably ssl-related, flask-googlemaps issue, on a heroku deploy In-Reply-To: References: Message-ID: The issue was that I had unused js files that were making reference to http, not https. This caused the "mixed content" warnings in firefox. Also flask-googlemaps 0.1.8 sets up a map using api referencing http. It turned out there was a commit a couple days ago in that project fixing just this issue. After updating flask-googlemaps to 0.1.9, the map loads just fine. Thanks again Jianfeng, for pointing this out to me. -Kyle On Sun, Dec 20, 2015 at 10:43 PM, Kyle Lawlor wrote: > Hi, all. > > I recently uploaded my web app onto Heroku. It is a site that I am making > for a friends restaurant: lacasadelsabor.herokuapp.com > > The trouble is that I'm using *Flask-Googlemaps* to display the > restaurant location, but the map does not load by default ( > lacasadelsabor.herokuapp.com/maps). I've noticed that if I "disable > protection for now" (in ubuntu firefox) the map does load. The map also > loads fine when run locally with gunicorn. (I did not test locally with > heroku yet). > > I'm using *Flask-SSLify* and that seems to be configured properly. (I've > got it so that it triggers only when run in the Heroku) > > curl -I http://lacasadelsabor.herokuapp.com >> >> HTTP/1.1 302 FOUND >> Connection: keep-alive >> Server: gunicorn/19.4.1 >> Date: Mon, 21 Dec 2015 03:29:47 GMT >> Content-Type: text/html; charset=utf-8 >> Content-Length: 281 >> Location: https://lacasadelsabor.herokuapp.com/ >> Via: 1.1 vegur >> > > Additionally I am seeing an alert in firefox by the ssl-lock icon. Which > says "firefox blocks parts of the page that are not are not secure". > > I'm sure that I am doing or missing something stupid. > Any pointers on where I should go from here? > > Thanks for your time, > Kyle > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klawlor419 at gmail.com Mon Dec 21 12:34:17 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Mon, 21 Dec 2015 12:34:17 -0500 Subject: [Flask] Flask Digest, Vol 6, Issue 7 In-Reply-To: References: Message-ID: Hi, David. Thanks for the response. I actually did not see it until the mailing list summary showed up in my inbox. Weird, this has happened once before. Anyways, thanks again! -Kyle On Mon, Dec 21, 2015 at 12:00 PM, 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. probably ssl-related, flask-googlemaps issue, on a heroku > deploy (Kyle Lawlor) > 2. Re: probably ssl-related, flask-googlemaps issue, on a heroku > deploy (David Nieder) > 3. Re: probably ssl-related, flask-googlemaps issue, on a heroku > deploy (Kyle Lawlor) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sun, 20 Dec 2015 22:43:37 -0500 > From: Kyle Lawlor > To: flask at python.org > Subject: [Flask] probably ssl-related, flask-googlemaps issue, on a > heroku deploy > Message-ID: > FBnh4nXg at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hi, all. > > I recently uploaded my web app onto Heroku. It is a site that I am making > for a friends restaurant: lacasadelsabor.herokuapp.com > > The trouble is that I'm using *Flask-Googlemaps* to display the restaurant > location, but the map does not load by default ( > lacasadelsabor.herokuapp.com/maps). I've noticed that if I "disable > protection for now" (in ubuntu firefox) the map does load. The map also > loads fine when run locally with gunicorn. (I did not test locally with > heroku yet). > > I'm using *Flask-SSLify* and that seems to be configured properly. (I've > got it so that it triggers only when run in the Heroku) > > curl -I http://lacasadelsabor.herokuapp.com > > > > HTTP/1.1 302 FOUND > > Connection: keep-alive > > Server: gunicorn/19.4.1 > > Date: Mon, 21 Dec 2015 03:29:47 GMT > > Content-Type: text/html; charset=utf-8 > > Content-Length: 281 > > Location: https://lacasadelsabor.herokuapp.com/ > > Via: 1.1 vegur > > > > Additionally I am seeing an alert in firefox by the ssl-lock icon. Which > says "firefox blocks parts of the page that are not are not secure". > > I'm sure that I am doing or missing something stupid. > Any pointers on where I should go from here? > > Thanks for your time, > Kyle > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/flask/attachments/20151220/3193c4ab/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Mon, 21 Dec 2015 10:09:14 +0100 > From: David Nieder > To: flask at python.org > Subject: Re: [Flask] probably ssl-related, flask-googlemaps issue, on > a heroku deploy > Message-ID: <5677C1BA.6080002 at gmx.de> > Content-Type: text/plain; charset=utf-8; format=flowed > > On 21.12.2015 04:43, Kyle Lawlor wrote: > > Hi, all. > > > > I recently uploaded my web app onto Heroku. It is a site that I am making > > for a friends restaurant: lacasadelsabor.herokuapp.com > > > > The trouble is that I'm using *Flask-Googlemaps* to display the > restaurant > > location, but the map does not load by default ( > > lacasadelsabor.herokuapp.com/maps). I've noticed that if I "disable > > protection for now" (in ubuntu firefox) the map does load. The map also > > loads fine when run locally with gunicorn. (I did not test locally with > > heroku yet). > > > > I'm using *Flask-SSLify* and that seems to be configured properly. (I've > > got it so that it triggers only when run in the Heroku) > > > > curl -I http://lacasadelsabor.herokuapp.com > >> > >> HTTP/1.1 302 FOUND > >> Connection: keep-alive > >> Server: gunicorn/19.4.1 > >> Date: Mon, 21 Dec 2015 03:29:47 GMT > >> Content-Type: text/html; charset=utf-8 > >> Content-Length: 281 > >> Location: https://lacasadelsabor.herokuapp.com/ > >> Via: 1.1 vegur > >> > > > > Additionally I am seeing an alert in firefox by the ssl-lock icon. Which > > says "firefox blocks parts of the page that are not are not secure". > > > > The problem is that you tell the browser to load resources over http > while your site was served over https. Modern browsers won't do that. > > I'm guessing that flask-googlemaps included those lines. > The latest commit on github seems to deal with this issue. > > https://github.com/rochacbruno/Flask-GoogleMaps/commit/c7b5979684ff7bf11d90270a56bae44e461de9fb > > Try updating the extensions and check if you have version 0.1.9 > installed. That probably solves this issue. > > If you've included urls yourself just change the url scheme to https or > use relative schemes: > > > > > I'm sure that I am doing or missing something stupid. > > Any pointers on where I should go from here? > > > > Thanks for your time, > > Kyle > > > > > > > > > > > ------------------------------ > > Message: 3 > Date: Mon, 21 Dec 2015 11:39:47 -0500 > From: Kyle Lawlor > To: flask at python.org > Subject: Re: [Flask] probably ssl-related, flask-googlemaps issue, on > a heroku deploy > Message-ID: > < > CACaYNLQpHyy5QeV4dxi18EkFmPde08D53PsS05Nxk+9f2jS_UA at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > The issue was that I had unused js files that were making reference to > http, not https. This caused the "mixed content" warnings in firefox. > > Also flask-googlemaps > 0.1.8 sets up a map using api referencing http. It turned out there was a > commit > < > https://github.com/rochacbruno/Flask-GoogleMaps/commit/c7b5979684ff7bf11d90270a56bae44e461de9fb > > > a couple days ago in that project fixing just this issue. > > After updating flask-googlemaps to 0.1.9, the map loads just fine. Thanks > again Jianfeng, for pointing this out to me. > > -Kyle > > On Sun, Dec 20, 2015 at 10:43 PM, Kyle Lawlor > wrote: > > > Hi, all. > > > > I recently uploaded my web app onto Heroku. It is a site that I am making > > for a friends restaurant: lacasadelsabor.herokuapp.com > > > > The trouble is that I'm using *Flask-Googlemaps* to display the > > restaurant location, but the map does not load by default ( > > lacasadelsabor.herokuapp.com/maps). I've noticed that if I "disable > > protection for now" (in ubuntu firefox) the map does load. The map also > > loads fine when run locally with gunicorn. (I did not test locally with > > heroku yet). > > > > I'm using *Flask-SSLify* and that seems to be configured properly. (I've > > got it so that it triggers only when run in the Heroku) > > > > curl -I http://lacasadelsabor.herokuapp.com > >> > >> HTTP/1.1 302 FOUND > >> Connection: keep-alive > >> Server: gunicorn/19.4.1 > >> Date: Mon, 21 Dec 2015 03:29:47 GMT > >> Content-Type: text/html; charset=utf-8 > >> Content-Length: 281 > >> Location: https://lacasadelsabor.herokuapp.com/ > >> Via: 1.1 vegur > >> > > > > Additionally I am seeing an alert in firefox by the ssl-lock icon. Which > > says "firefox blocks parts of the page that are not are not secure". > > > > I'm sure that I am doing or missing something stupid. > > Any pointers on where I should go from here? > > > > Thanks for your time, > > Kyle > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/flask/attachments/20151221/e7c4a2bc/attachment-0001.html > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > > ------------------------------ > > End of Flask Digest, Vol 6, Issue 7 > *********************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From flask1218 at yeah.net Tue Dec 22 17:13:03 2015 From: flask1218 at yeah.net (=?UTF-8?B?5pyx5om/5rWp?=) Date: Wed, 23 Dec 2015 06:13:03 +0800 (CST) Subject: [Flask] the startapp command for flask Message-ID: <3a49c034.78.151cbc0b8c6.Coremail.flask1218@yeah.net> Hello, everyone !!! I create a startapp command for flask called mana https://github.com/neo1218/mana hope can let flask development become faster and convenient. I hope you can share your thoughts with me, thx!!! -------------- next part -------------- An HTML attachment was scrubbed... URL: From gansteed at gmail.com Tue Dec 22 21:48:52 2015 From: gansteed at gmail.com (gansteed) Date: Wed, 23 Dec 2015 02:48:52 +0000 Subject: [Flask] the startapp command for flask In-Reply-To: <3a49c034.78.151cbc0b8c6.Coremail.flask1218@yeah.net> References: <3a49c034.78.151cbc0b8c6.Coremail.flask1218@yeah.net> Message-ID: the link is broken, it's `https://github.com/neo1218/mana`, not ` https://github.com/neo1218/mana),` ??? ?2015?12?23??? ??6:44??? > Hello, everyone !!! I create a startapp command for flask called mana > https://github.com/neo1218/mana > hope can let flask development become faster and convenient. > I hope you can share your thoughts with me, thx!!! > > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klawlor419 at gmail.com Wed Dec 23 13:02:57 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Wed, 23 Dec 2015 13:02:57 -0500 Subject: [Flask] redirect and keep position on page Message-ID: Hi, all. So I have a menu page, where items are listed and customers choose to add items to a floating div (shopping cart). After a menu item is added, I issue a redirect to the menu page after adding the selected item to the cart. But the page re-loads at the top. What are some ways I could re-load the page at the current position? A lot of the Flask extensions use # "hashtags" as place holders, I can see using that type of system to solve this, by re-directing to the current items hashtag. Thanks for any input, Kyle -------------- next part -------------- An HTML attachment was scrubbed... URL: From dorian.hoxha at gmail.com Thu Dec 24 04:49:44 2015 From: dorian.hoxha at gmail.com (Dorian Hoxha) Date: Thu, 24 Dec 2015 10:49:44 +0100 Subject: [Flask] redirect and keep position on page In-Reply-To: References: Message-ID: Here it's explained how anchor tags work on html: http://help.typepad.com/anchor-tags.html On Wed, Dec 23, 2015 at 7:02 PM, Kyle Lawlor wrote: > Hi, all. > > So I have a menu page, where items are listed and customers choose to add > items to a floating div (shopping cart). After a menu item is added, I > issue a redirect to the menu page after adding the selected item to the > cart. But the page re-loads at the top. > > What are some ways I could re-load the page at the current position? A lot > of the Flask extensions use # "hashtags" as place holders, I can see using > that type of system to solve this, by re-directing to the current items > hashtag. > > Thanks for any input, > Kyle > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klawlor419 at gmail.com Sat Dec 26 21:59:44 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Sat, 26 Dec 2015 21:59:44 -0500 Subject: [Flask] redirect and keep position on page In-Reply-To: References: Message-ID: Thanks, Dorian. That's what I was looking for. On Thu, Dec 24, 2015 at 4:49 AM, Dorian Hoxha wrote: > Here it's explained how anchor tags work on html: > http://help.typepad.com/anchor-tags.html > > On Wed, Dec 23, 2015 at 7:02 PM, Kyle Lawlor wrote: > >> Hi, all. >> >> So I have a menu page, where items are listed and customers choose to add >> items to a floating div (shopping cart). After a menu item is added, I >> issue a redirect to the menu page after adding the selected item to the >> cart. But the page re-loads at the top. >> >> What are some ways I could re-load the page at the current position? A >> lot of the Flask extensions use # "hashtags" as place holders, I can see >> using that type of system to solve this, by re-directing to the current >> items hashtag. >> >> Thanks for any input, >> Kyle >> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dorian.hoxha at gmail.com Mon Dec 28 11:53:41 2015 From: dorian.hoxha at gmail.com (Dorian Hoxha) Date: Mon, 28 Dec 2015 17:53:41 +0100 Subject: [Flask] Request Only Attributes Security Question In-Reply-To: References: Message-ID: You should use request teardown (check flask-sqlalchemy for example) because that is executed even if the request has an error (after request isn't executed in that case). As for threading, check out: http://flask.pocoo.org/docs/0.10/design/ http://stackoverflow.com/questions/25887910/what-does-thread-local-objects-mean-in-flask On Sat, Dec 19, 2015 at 12:03 AM, Jonathan Chen wrote: > So I've been making an extension over the past six months that we are > using internally at my company. So I've been running into a few issues here > and there. The basic premise of the extension (more like a mini-framework) > Is that it expose custom redis objects via a REST Api with some security. > > We use security tokens to authenticate for the REST API's, for a while > I've been stuffing the token in _app_ctx_stack.top, but I've started to > notice that the token sometimes persists beyond the first request. So I've > been using an app.after_request() function to delete the token from > _app_ctx_stack.top. > > Is this the best place to keep the token? Is there a chance I might run > into any issues? (threading)? > > > ~Jonathan C. > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pramod_nair1984 at yahoo.com Thu Dec 31 09:49:58 2015 From: pramod_nair1984 at yahoo.com (C.PRAMOD NAIR) Date: Thu, 31 Dec 2015 14:49:58 +0000 (UTC) Subject: [Flask] Persistent SSH Connection in Flask App References: <57379407.5283719.1451573398404.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <57379407.5283719.1451573398404.JavaMail.yahoo@mail.yahoo.com> Hello All, I am trying to create a Flask APP to run command on remote server, I am able to connect to remote using pexpect.pxssh. Code snippet is in below link, the issue here is that the connect_ssh is getting called for each request. I want to know if it's possible to create persistent ssh connection. http://stackoverflow.com/questions/34509746/ssh-persistent-connection-using-pxssh-in-flask Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: