Browse files

Fixed issue #79.

  • Loading branch information...
1 parent 7154f2c commit 012bc8915acdf8b0d7eadc37191e9ed6a15c9c45 @jfinkels committed Jul 3, 2012
Showing with 12 additions and 1 deletion.
  1. +4 −0 CHANGES
  2. +1 −1 flask_restless/manager.py
  3. +7 −0 tests/test_manager.py
View
4 CHANGES
@@ -13,6 +13,10 @@ Version 0.7-dev
Not yet released.
+- Fixed `issue #79 <https://github.com/jfinkels/flask-restless/issues/79>`_:
+ attempted to access attribute of ``None`` in constructor of
+ :class:`APIManager`.
+
Version 0.6
-----------
View
2 flask_restless/manager.py
@@ -184,7 +184,7 @@ def init_app(self, app, session=None, flask_sqlalchemy_db=None):
"""
self.app = app
- self.session = session or flask_sqlalchemy_db.session
+ self.session = session or getattr(flask_sqlalchemy_db, 'session', None)
if isinstance(self.session, type):
self.session = scoped_session(self.session)
View
7 tests/test_manager.py
@@ -43,6 +43,13 @@ class APIManagerTest(TestSupport):
"""
+ def test_constructor(self):
+ """Tests that no error occurs on instantiation without any arguments to
+ the constructor.
+
+ """
+ APIManager()
+
def test_init_app(self):
"""Tests for initializing the Flask application after instantiating the
:class:`flask.ext.restless.APIManager` object.

0 comments on commit 012bc89

Please sign in to comment.