Move app initialization to MongoRest().init_app(app)
Move MongoRest and company out of __init__.py and into mongorest.py
There's a workaround required here to support the decorator registration pattern exposed. Not all views are guaranteed to be imported/registered at the time init_app(app) is called. If MongoRest does not keep a running list of app objects it needs to register views to, none of those will actually be registered. So, this implements a delayed app class that just collects args/kwargs, then also collects a list of references to apps. Views are batch registered during init_app, then also registered to previously-initialized apps within MongoRest.register.
Closes https://github.com/closeio/flask-mongorest/issues/81
MongoRest
classMongoRest().init_app(app)
MongoRest
and company out of__init__.py
and intomongorest.py
There's a workaround required here to support the decorator registration pattern exposed. Not all views are guaranteed to be imported/registered at the time
init_app(app)
is called. IfMongoRest
does not keep a running list of app objects it needs to register views to, none of those will actually be registered. So, this implements a delayed app class that just collects args/kwargs, then also collects a list of references to apps. Views are batch registered duringinit_app
, then also registered to previously-initialized apps withinMongoRest.register
.