From clint.olsen at gmail.com Wed Apr 1 17:44:42 2020 From: clint.olsen at gmail.com (Clint Olsen) Date: Wed, 1 Apr 2020 14:44:42 -0700 Subject: [Flask] Unexplained error message: PermissionError: [Errno 1] Operation not permitted Message-ID: Occasionally on page loads, I'm seeing the following error: Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: Traceback (most recent call last): Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: worker.init_process() Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 162, in init_process Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: super().init_process() Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/base.py", line 140, in init_process Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.run() Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 102, in run Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.notify() Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 66, in notify Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: super().notify() Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/base.py", line 74, in notify Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.tmp.notify() Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/workertmp.py", line 46, in notify Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: os.fchmod(self._tmp.fileno(), self.spinner) Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: PermissionError: [Errno 1] Operation not permitted How can I debug this? Thanks, -Clint -------------- next part -------------- An HTML attachment was scrubbed... URL: From unai at sysbible.org Thu Apr 2 02:46:09 2020 From: unai at sysbible.org (Unai Rodriguez) Date: Thu, 02 Apr 2020 08:46:09 +0200 Subject: [Flask] =?utf-8?q?Unexplained_error_message=3A_PermissionError?= =?utf-8?q?=3A_=5BErrno_1=5D_Operation_not_permitted?= In-Reply-To: References: Message-ID: <974bbd06-34d9-4221-920f-c9ffd8196894@www.fastmail.com> When/how do you reproduce it? -- unai On Wed, Apr 1, 2020, at 11:44 PM, Clint Olsen wrote: > Occasionally on page loads, I'm seeing the following error: > > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: Traceback (most recent call last): > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: worker.init_process() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 162, in init_process > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: super().init_process() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/base.py", line 140, in init_process > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.run() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 102, in run > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.notify() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", line 66, in notify > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: super().notify() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/base.py", line 74, in notify > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.tmp.notify() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/workertmp.py", line 46, in notify > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: os.fchmod(self._tmp.fileno(), self.spinner) > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: PermissionError: [Errno 1] Operation not permitted > > How can I debug this? > > Thanks, > > -Clint > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From clint.olsen at gmail.com Thu Apr 2 15:55:54 2020 From: clint.olsen at gmail.com (Clint Olsen) Date: Thu, 2 Apr 2020 12:55:54 -0700 Subject: [Flask] Unexplained error message: PermissionError: [Errno 1] Operation not permitted In-Reply-To: <974bbd06-34d9-4221-920f-c9ffd8196894@www.fastmail.com> References: <974bbd06-34d9-4221-920f-c9ffd8196894@www.fastmail.com> Message-ID: Hi: It was just on one of my routes. I think I figured it out. I was querying a Mongo DB while I was in a context manager in reduced privileges (stepping down to a non-privileged user). My *guess* is that there is some file monitoring/fiddling during a mongo query, and I bet there was a privilege mismatch. Getting that code out of there made this problem go away. Thanks, -Clint On Wed, Apr 1, 2020 at 11:47 PM Unai Rodriguez wrote: > When/how do you reproduce it? > > -- unai > > > On Wed, Apr 1, 2020, at 11:44 PM, Clint Olsen wrote: > > Occasionally on page loads, I'm seeing the following error: > > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: Traceback (most recent call > last): > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/arbiter.py", > line 583, in spawn_worker > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: worker.init_process() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", > line 162, in init_process > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: super().init_process() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/base.py", > line 140, in init_process > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.run() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", > line 102, in run > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.notify() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/ggevent.py", > line 66, in notify > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: super().notify() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/base.py", > line 74, in notify > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: self.tmp.notify() > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: File > "/opt/local/python3.6/lib/python3.6/site-packages/gunicorn/workers/workertmp.py", > line 46, in notify > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: > os.fchmod(self._tmp.fileno(), self.spinner) > Apr 1 14:41:36 cpu-paw-01 gunicorn[1869]: PermissionError: [Errno 1] > Operation not permitted > > How can I debug this? > > Thanks, > > -Clint > _______________________________________________ > 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 sub at trias.org Wed Apr 15 17:15:57 2020 From: sub at trias.org (F Trias) Date: Wed, 15 Apr 2020 17:15:57 -0400 Subject: [Flask] Python wrapper for JS with AJAX Message-ID: I recently developed a library that uses AJAX strategies and Python's dynamic syntax (__getattr__, etc.) to allow seamless access to Javascript and the DOM directly from Python and vice versa. It works with Flask but can easily be ported to other frameworks. I was wondering where I would go announcing it to see if it might be useful to other people? If this is the wrong venue, my apologies. Here is an example. It creates a special "js" class that dynamically creates a Javascript statement and sends it to the browser for execution. Likewise, on the browser, it uses Javascript's Proxy object to dynamically build python statements and ships them back to python for evaluation. Github: https://ftrias.github.io/jyserver # HTML

0

# Python from flask import Flask, render_template, request app = Flask(__name__) import jyserver.Flask as jsf @jsf.use(app) class App: def __init__(self): self.count = 0 def increment(self): self.count += 1 self.js.document.getElementById("count").innerHTML = self.count @app.route('/') def index_page(): return App.render(render_template('flask-simple.html')) -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard at walnut.gen.nz Thu Apr 16 22:17:23 2020 From: richard at walnut.gen.nz (Richard Hector) Date: Fri, 17 Apr 2020 14:17:23 +1200 Subject: [Flask] Session question Message-ID: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> Hi all, I hope this is the right place to ask. I've been doing the Flask Mega Tutorial. It appears that sessions are stored in a cookie/cookies in the browser, rather than just setting a random session id and storing in the database or whatever. I was under the impression (though I'm a web development newbie) that this wasn't considered best practice. Is there a way to change this behaviour, to store the session info server-side instead? Thanks, Richard From cs at cskk.id.au Thu Apr 16 22:44:44 2020 From: cs at cskk.id.au (Cameron Simpson) Date: Fri, 17 Apr 2020 12:44:44 +1000 Subject: [Flask] Session question In-Reply-To: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> References: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> Message-ID: <20200417024444.GA94687@cskk.homeip.net> On 17Apr2020 14:17, Richard Hector wrote: >It appears that sessions are stored in a cookie/cookies in the browser, >rather than just setting a random session id and storing in the database >or whatever. I was under the impression (though I'm a web development >newbie) that this wasn't considered best practice. Is there a way to >change this behaviour, to store the session info server-side instead? It depends what you do. The cookie side session is for state you need to share with the browser anyway: the logged in user, or other brwoser/client side data. Of course you should keep server-private data on the server side. So (a) there should be no "secrets" in the cookie side session data, only data the browser app would already know and (b) the session cookie is signed against a server side secret. That latter means that a hostile browser/client cannot modify the session cookie and have the changed believed by the server, because the cookie signature would then be invalid. So, yes, most state should be server side. The cookie session stuff is for state the client needs to know anyway. Cheers, Cameron Simpson From ford.anthonyj at gmail.com Thu Apr 16 22:49:31 2020 From: ford.anthonyj at gmail.com (Ford) Date: Thu, 16 Apr 2020 21:49:31 -0500 Subject: [Flask] Session question In-Reply-To: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> References: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> Message-ID: Flask uses cryptographically signed cookies, which prevents the user from being able to modify the cookies. It would however be ill-advised to store any personally identifiable information or anything critical. There are server-side options available as extensions, such as Flask-Session (https://pythonhosted.org/Flask-Session/, https://hackersandslackers.com/managing-user-session-variables-with-flask-sessions-and-redis/), and Flask-Sessionstore (https://flask-sessionstore.readthedocs.io/en/latest/ ). Anthony Ford On Thu, Apr 16, 2020 at 9:18 PM Richard Hector wrote: > Hi all, I hope this is the right place to ask. > > I've been doing the Flask Mega Tutorial. > > It appears that sessions are stored in a cookie/cookies in the browser, > rather than just setting a random session id and storing in the database > or whatever. I was under the impression (though I'm a web development > newbie) that this wasn't considered best practice. Is there a way to > change this behaviour, to store the session info server-side instead? > > Thanks, > Richard > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard at walnut.gen.nz Fri Apr 17 00:05:16 2020 From: richard at walnut.gen.nz (Richard Hector) Date: Fri, 17 Apr 2020 16:05:16 +1200 Subject: [Flask] Session question In-Reply-To: References: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> Message-ID: <344cceb3-3069-f7fb-bebe-d674039df523@walnut.gen.nz> Thanks Andrew, Now that I know that these exist, I think I'll continue with the tutorial, and get back to this issue later. Both of those seem to have nearly identical documentation - is one a fork of the other? Cheers, Richard On 17/04/20 2:49 pm, Ford wrote: > Flask uses cryptographically signed cookies, which prevents the user > from being able to modify the cookies. It would however be ill-advised > to store any personally identifiable information or anything critical. > > There are server-side options available as extensions, such as > Flask-Session > (https://pythonhosted.org/Flask-Session/,?https://hackersandslackers.com/managing-user-session-variables-with-flask-sessions-and-redis/), > and Flask-Sessionstore > (https://flask-sessionstore.readthedocs.io/en/latest/). > > Anthony Ford > > > On Thu, Apr 16, 2020 at 9:18 PM Richard Hector > wrote: > > Hi all, I hope this is the right place to ask. > > I've been doing the Flask Mega Tutorial. > > It appears that sessions are stored in a cookie/cookies in the browser, > rather than just setting a random session id and storing in the database > or whatever. I was under the impression (though I'm a web development > newbie) that this wasn't considered best practice. Is there a way to > change this behaviour, to store the session info server-side instead? > > Thanks, > Richard > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > From ford.anthonyj at gmail.com Fri Apr 17 12:37:44 2020 From: ford.anthonyj at gmail.com (Ford) Date: Fri, 17 Apr 2020 11:37:44 -0500 Subject: [Flask] Session question In-Reply-To: <344cceb3-3069-f7fb-bebe-d674039df523@walnut.gen.nz> References: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> <344cceb3-3069-f7fb-bebe-d674039df523@walnut.gen.nz> Message-ID: Looks like you hit the nail on the head. According to Flask-Sessionstore's github repo, it's a hard fork of Flask-Session. See https://github.com/mcrowson/flask-sessionstore Looks like Flask-Session is no longer being maintained, hence the fork. Anthony Ford On Thu, Apr 16, 2020 at 11:05 PM Richard Hector wrote: > Thanks Andrew, > > Now that I know that these exist, I think I'll continue with the > tutorial, and get back to this issue later. > > Both of those seem to have nearly identical documentation - is one a > fork of the other? > > Cheers, > Richard > > On 17/04/20 2:49 pm, Ford wrote: > > Flask uses cryptographically signed cookies, which prevents the user > > from being able to modify the cookies. It would however be ill-advised > > to store any personally identifiable information or anything critical. > > > > There are server-side options available as extensions, such as > > Flask-Session > > (https://pythonhosted.org/Flask-Session/, > https://hackersandslackers.com/managing-user-session-variables-with-flask-sessions-and-redis/ > ), > > and Flask-Sessionstore > > (https://flask-sessionstore.readthedocs.io/en/latest/). > > > > Anthony Ford > > > > > > On Thu, Apr 16, 2020 at 9:18 PM Richard Hector > > wrote: > > > > Hi all, I hope this is the right place to ask. > > > > I've been doing the Flask Mega Tutorial. > > > > It appears that sessions are stored in a cookie/cookies in the > browser, > > rather than just setting a random session id and storing in the > database > > or whatever. I was under the impression (though I'm a web development > > newbie) that this wasn't considered best practice. Is there a way to > > change this behaviour, to store the session info server-side instead? > > > > Thanks, > > Richard > > _______________________________________________ > > Flask mailing list > > Flask at python.org > > https://mail.python.org/mailman/listinfo/flask > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pauloric at contatogs.com.br Sun Apr 19 10:47:53 2020 From: pauloric at contatogs.com.br (pauloric at contatogs.com.br) Date: Sun, 19 Apr 2020 11:47:53 -0300 (BRT) Subject: [Flask] flask ldapconn Message-ID: <2083263207.532.1587307673228.JavaMail.zimbra@contatogs.com.br> Hi all Does anyone here works with flask-ldapconn ? Is it ease to work, complex ? best regards -- Paulo Ricardo Bruck consultor tel 011 3596-4881 011 98140-9184(TIM/Whats) [ http://www.contatogs.com.br/ | http://www.contatogs.com.br ] gpg AAA59989 at wwwkeys.us.pgp.net skype: suportecontatogs -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard at walnut.gen.nz Sun Apr 19 11:31:56 2020 From: richard at walnut.gen.nz (Richard Hector) Date: Mon, 20 Apr 2020 03:31:56 +1200 Subject: [Flask] Session question In-Reply-To: References: <214c462d-a934-4cc8-fc05-f5966160969e@walnut.gen.nz> <344cceb3-3069-f7fb-bebe-d674039df523@walnut.gen.nz> Message-ID: Actually, the README.md suggests Flask-Sessionstore is no longer maintained either :-( Richard On 18/04/20 4:37 am, Ford wrote: > Looks like you hit the nail?on the head. > > According to Flask-Sessionstore's?github repo, it's a hard fork of > Flask-Session. See?https://github.com/mcrowson/flask-sessionstore > > Looks like Flask-Session is no longer being maintained, hence the fork. > > Anthony Ford > > On Thu, Apr 16, 2020 at 11:05 PM Richard Hector > wrote: > > Thanks Andrew, > > Now that I know that these exist, I think I'll continue with the > tutorial, and get back to this issue later. > > Both of those seem to have nearly identical documentation - is one a > fork of the other? > > Cheers, > Richard > > On 17/04/20 2:49 pm, Ford wrote: > > Flask uses cryptographically signed cookies, which prevents the user > > from being able to modify the cookies. It would however be ill-advised > > to store any personally identifiable information or anything critical. > > > > There are server-side options available as extensions, such as > > Flask-Session > > > (https://pythonhosted.org/Flask-Session/,?https://hackersandslackers.com/managing-user-session-variables-with-flask-sessions-and-redis/), > > and Flask-Sessionstore > > (https://flask-sessionstore.readthedocs.io/en/latest/). > > > > Anthony Ford > > > > > > On Thu, Apr 16, 2020 at 9:18 PM Richard Hector > > > >> wrote: > > > >? ? ?Hi all, I hope this is the right place to ask. > > > >? ? ?I've been doing the Flask Mega Tutorial. > > > >? ? ?It appears that sessions are stored in a cookie/cookies in the > browser, > >? ? ?rather than just setting a random session id and storing in > the database > >? ? ?or whatever. I was under the impression (though I'm a web > development > >? ? ?newbie) that this wasn't considered best practice. Is there a > way to > >? ? ?change this behaviour, to store the session info server-side > instead? > > > >? ? ?Thanks, > >? ? ?Richard > >? ? ?_______________________________________________ > >? ? ?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 ccp at drsb.com.my Thu Apr 23 03:17:24 2020 From: ccp at drsb.com.my (CCP Dragonedge) Date: Thu, 23 Apr 2020 15:17:24 +0800 Subject: [Flask] Is there a way to periodically save form data without requiring the user to click on a button? Message-ID: Hi, Let's say I have 10 input fields on a form. The user has input data into four or five of them. Before he completes, he is called away from his or her desk - for a long time (eg meetings, phone call, etc). Let's assume that the user can't click on the Submit button yet because all of the fields haven't been input. So, the record isn't saved... Is there a way for Flask to save it on the client side? I read about Flask-Socketio, but that seems kind of overkill. Or is this outside the scope of Flask, and in the realm of Javascript? I found out about HTML5 Local Storage (or WebStorage). To my understanding, however, that's in Javascript, so then AJAX gets involved if I want to pass the saved value back to Flask, right? p -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.watrous at Trinet.com Thu Apr 23 07:43:33 2020 From: daniel.watrous at Trinet.com (Daniel Watrous) Date: Thu, 23 Apr 2020 11:43:33 +0000 Subject: [Flask] Is there a way to periodically save form data without requiring the user to click on a button? In-Reply-To: References: Message-ID: <8B9BE1E4-6A97-41A4-85C4-0CD7EEE624BB@trinet.com> P, There are a few patterns that could work for this, but none of them are specific to flask. 1. If the form can be tied to an existing user account, you could cache the form details in a staging table. This could be done periodically as they are providing data. If they are unable to complete the forms, they can simply login later (from anywhere) and resume editing the forms. 2. If the session cannot be tied to a user, you might be able to do a check in JavaScript to see if the session has expired. If it has, the login process can be done in a pop-over that doesn?t disturb the contents of the forms. 3. You could indicate that the user has a limited time session and must complete the form in that amount of time. If they don?t, you can reset the form and have them start fresh when they have that amount of time. There can obviously be variations on the above. Notice that the first two just have to do with caching the user?s partial response. There are a lot of ways to do this, both on the backend and on the client side. Daniel From: Flask on behalf of CCP Dragonedge Date: Thursday, April 23, 2020 at 2:47 AM To: flask Subject: [Flask] Is there a way to periodically save form data without requiring the user to click on a button? WARNING: Do not click links or open attachments unless you recognize the source of the email and know the contents are safe. Hi, Let's say I have 10 input fields on a form. The user has input data into four or five of them. Before he completes, he is called away from his or her desk - for a long time (eg meetings, phone call, etc). Let's assume that the user can't click on the Submit button yet because all of the fields haven't been input. So, the record isn't saved... Is there a way for Flask to save it on the client side? I read about Flask-Socketio, but that seems kind of overkill. Or is this outside the scope of Flask, and in the realm of Javascript? I found out about HTML5 Local Storage (or WebStorage). To my understanding, however, that's in Javascript, so then AJAX gets involved if I want to pass the saved value back to Flask, right? p -------------- next part -------------- An HTML attachment was scrubbed... URL: From marcnarc at xiplink.com Thu Apr 23 11:05:45 2020 From: marcnarc at xiplink.com (Marc Branchaud) Date: Thu, 23 Apr 2020 11:05:45 -0400 Subject: [Flask] Is there a way to periodically save form data without requiring the user to click on a button? In-Reply-To: References: Message-ID: On 2020-04-23 3:17 a.m., CCP Dragonedge wrote: > Hi, > > Let's say I have 10 input fields on a form. The user has input data into > four or five of them. Before he completes, he is called away from his or > her desk - for a long time (eg meetings, phone call, etc). > > Let's assume that the user can't click on the Submit button yet because > all of the fields haven't been input. So, the record isn't saved... > > Is there a way for Flask to save it on the client side? I read about > Flask-Socketio, but that seems kind of overkill. > > Or is this outside the scope of Flask, and in the realm of Javascript? I > found out about HTML5 Local Storage (or WebStorage). To my > understanding, however, that's in Javascript, so then AJAX gets involved > if I want to pass the saved value back to Flask, right? Right -- AJAX, or some other form of communication. Flask can support whatever you want to use. In our UI we automatically save input data to the server, separately from the user "submitting" the data. (We basically have lots of forms presented on different pages, and the user wants to fill in everything before "applying" the updates all at once.) We use AJAX to save the user's work as they go. So even if they close the browser and come back days later, their work is still where they left it. One thing about this model is that you're faced with a choice: Do you save the changes on every keystroke? In our system that's impractical, so we only save when the input blurs. (We could also implement a timeout to save after the user stops typing, but we haven't.) There can be tricky edge cases to this approach, depending on your app's complexity. M. From pauloric at contatogs.com.br Mon Apr 27 17:26:39 2020 From: pauloric at contatogs.com.br (pauloric at contatogs.com.br) Date: Mon, 27 Apr 2020 18:26:39 -0300 (BRT) Subject: [Flask] contract a flask developer to use python3-ldapconn Message-ID: <103577011.693.1588022799392.JavaMail.zimbra@contatogs.com.br> Hi All I would like to contract for a small job for implement flask using: ubuntu 20.04 python3-ldap3 python3-flask python3-ldapconn openldap + start_tls + strong autentication no virtualenv What I need A simple flask that should allow me to: search, create, delete and modify a user based on ldap server. I already have all running using python3-ldap3 and openldap + start_tls + strong autentication. Developer should just keep in mind flask part. Anyone interested? please send email in private . best regards -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreybrett at gmail.com Mon Apr 27 18:05:41 2020 From: coreybrett at gmail.com (Corey Boyle) Date: Mon, 27 Apr 2020 18:05:41 -0400 Subject: [Flask] changeing wtform based forms during runtime Message-ID: Anyone have any nifty ways to alter forms at runtime? I have a form that has two different groups of fields that should only be included based on two conditions. I've tried the following... - Multiple form classes w/inheritance and if statements for creating the form - using the del keyword to remove fields (has to be combined with additional if statements when pre-filling form fields with existing record data - using a function to create the form class during runtime All these options can be made to work, but they all seem messy. Any suggestions? -------------- next part -------------- An HTML attachment was scrubbed... URL: