title: Importing a Flask-security instance into my views module breaks my webapp
body: <p>I'm writing the sign up/sign in system for a ecommerce site, and using flask-security (<a href="http://pythonhosted.org/Flask-Security/" rel="noreferrer">http://pythonhosted.org/Flask-Security/</a>) to handle the signup feature. Part of the basic setup requires the following signup.py module:</p>
  
  <pre><code>from flask.ext.security import SQLAlchemyUserDatastore, Security
  from app.models import User, Role
  from app import app, db
  
  # Setup Flask Security
  user_datastore = SQLAlchemyUserDatastore(db, User, Role)
  security = Security(app, user_datastore)
  </code></pre>
  
  <p>I then have to import the user_datastore and security objects into my views.py module as follows: </p>
  
  <pre><code>from app.signup import user_datastore, security
  </code></pre>
  
  <p>The thing is, as soon as I include the above import statement into my views module, my whole app crashes, and I get the following traceback error when I try to run my unit or behavior tests (edited for readability)</p>
  
  <pre><code>======================================================================
  ERROR: Failure: AttributeError ('_FakeSignal' object has no attribute 'connect_via')
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
      addr.filename, addr.module)
    File "/Library/Python/2.7/site-packages/nose/importer.py", line 47, in importFromPath
      return self.importFromDir(dir_path, fqname)
    File "/Library/Python/2.7/site-packages/nose/importer.py", line 94, in importFromDir
      mod = load_module(part_fqname, fh, filename, desc)
    File "/Users/faiyamrahman/programming/Python/WebApps/NibsNWhiskeyFull/tests/test_database.py", line 6, in &lt;module&gt;
      from app import app, db, models
    File "/Users/faiyamrahman/programming/Python/WebApps/NibsNWhiskeyFull/app/__init__.py", line 9, in &lt;module&gt;
      from app import views, models
    File "/Users/faiyamrahman/programming/Python/WebApps/NibsNWhiskeyFull/app/views.py", line 7, in &lt;module&gt;
      from app.signup import user_datastore
    File "/Users/faiyamrahman/programming/Python/WebApps/NibsNWhiskeyFull/app/signup.py", line 7, in &lt;module&gt;
      security = Security(app, user_datastore)
    File "/Users/faiyamrahman/programming/Python/WebApps/NibsNWhiskeyFull/flask/lib/python2.7/site-packages/flask_security/core.py", line 346, in __init__
      self._state = self.init_app(app, datastore, **kwargs)
    File "/Users/faiyamrahman/programming/Python/WebApps/NibsNWhiskeyFull/flask/lib/python2.7/site-packages/flask_security/core.py", line 368, in init_app
      identity_loaded.connect_via(app)(_on_identity_loaded)
  AttributeError: '_FakeSignal' object has no attribute 'connect_via'
  </code></pre>
  
  <p>I have no idea what this means. I've tried reading the flask-security documentation, but I don't understand why it's happening. Thanks to anyone who takes a stab at this!</p>