David added the comment:

when I do anything like this:

import flask ...

class User......
.
.
.

try:
    current_user
except NameError:
    global current_user
    current_user = User(request.form['parameter1'], request.form['parameter2'], 
'')


I get the error that current_user_user was 'used' before the global 
declaration. The try ... except ... is so when the user enters this route / 
function the first time, a class instance is instantiated, but if they return 
the second time, the existing class instance is updated in lines of code 
downstream rather than declared again with the same name, and therefore 
overwritten.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30887>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to