flask-fbapi icon indicating copy to clipboard operation
flask-fbapi copied to clipboard

Extension does not support multiple apps

Open mitsuhiko opened this issue 14 years ago • 2 comments

The extension currently stores the application on self in all cases, even if initialized with init_app. This is something Flask extensions should not really do if they can avoid it. :)

mitsuhiko avatar Aug 29 '11 22:08 mitsuhiko

Not a big deal. Whole FbApi object is a last minute addition to make it extension friendly.

I need from it ctx.token_storage and ctx.token_storage.open(). self.app is not used.

In fact putting ctx.token_storage.open() on before_request and teardown_request (close()) is by the book but seems to be an unnecessary step. I need it only for decorated views and decorator could do it by himself, but... There will be a need to pass app as a decorator argument. Will it be OK?

Second question, since I have you there :) How should the view be defined by an extension? App object is not available.

munhitsu avatar Aug 29 '11 22:08 munhitsu

Ah damn. Missed that ticket somehow.

Second question, since I have you there :) How should the view be defined by an extension? App object is not available.

Register all that needs to be registered when init_app is called. At that point you do have the app. Local functions with closures help :-)

mitsuhiko avatar Sep 10 '11 21:09 mitsuhiko