jfinkels/flask-restless — pull request #226 by croach (2013-06-22 00:41:16+00:00)
Title: Removed a dependency on the Flask app from create_api_blueprint

The create_api_blueprint calls _next_blueprint_name which, in turn,
checks all blueprints on the Flask app object to see if any previously
registered blueprints have a matching name and, if so, it returns a
new name with a suffixed index. This creates a dependency on the app
object in the create_api_blueprint method. This can cause problems in
situations where the developer wishes to move the creation of the API
endpoints into a module separate from the one in which the app object
is created. Allowing the user to create blueprints for API endpoints
in a separate module without the need to import the app object is key
in preventing a circular dependency between modules.

Since creating an API blueprint is more of a "power user" function, it
stands to reason that making sure the name of the blueprint does not
overlap other registered blueprints should be a responsibility of the
developer. For this reason, I've moved the call to
_next_blueprint_name out of the create_api_blueprint method and into
the create_api method. In the latter case, things are a bit more
automated and the case for renaming blueprints is a little stronger
there.