twilio/flask-restful — pull request #130 by mattupstate (2013-09-17 21:47:45+00:00)
Title: Factory fix

Adjusted the `init_app` function to follow the general extension guidelines and switched all calls to `self.app` to `current_app` where appropriate. The only thing this may impact is developers using the factory pattern incorrectly. Meaning that the following will not work (which was how the `test_api_delayed_initialization` was written):

```python
app = Flask(__name__)

api = Api()
api.init_app(app)

api.add_resource(MyResource, '/')
```

The test didn't even test anything anyway, so I fixed that as well. At any rate, the `add_resource` call must be made before `init_app` is called in order for the `app` instance to be configured with the correct state of the `api` instance:

```python
app = Flask(__name__)

api = Api()
api.add_resource(MyResource, '/')
api.init_app(app)
```