Flask-Security user_registered Signal Not Received in Python 3.3, but works in 2.7 Flask-Security user_registered Signal Not Received in Python 3.3, but works in 2.7 flask flask

Flask-Security user_registered Signal Not Received in Python 3.3, but works in 2.7


I was able to do this with something like:

security = Security(app, user_datastore,         register_form=ExtendedRegisterForm)@user_registered.connect_via(app)def user_registered_sighandler(app, user, confirm_token):    default_role = user_datastore.find_role("Pending")    user_datastore.add_role_to_user(user, default_role)    db.session.commit()


If the import for user_registered is changed to the following:

from flask.ext.security import user_registered

then the signal will work as expected in python 3.3 and call the user_registered_sighandler function when a user is registered.

The user_registered signal is imported within the __init__.py file for flask-security so it is also available at the top level of the package.