Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upBlueprints and Extensions and SQLAlchemy #289
Comments
This comment has been minimized.
This comment has been minimized.
|
It depends from the use case. I have following assumptions:
For #1, snippet can look like: |
This comment has been minimized.
This comment has been minimized.
|
I came across this issue with my bugLink project (http://buglink.readthedocs.org/), where the basic app knows about the relationship changeset <-> issue, and extensions to the app should provide release <-> build <-> changeset ( <-> issue). My understanding of this is that Blueprint are intended to extend the views. If you need to extend the model, you need to define something like a YellowPrint. As the model is highly coupled with the controller, YellowPrint could also have some mechanism in place to extend your controller. But there is no point in extending the controller if you don't make use of the extension provided. Here we come back to the views. Which brings us to the GreenPrint if you need to extend the views and the model. |
This comment has been minimized.
This comment has been minimized.
|
I don't know if this is exactly the situation you are describing, but I have something that looks like this in Flask-Restless. Check out http://readthedocs.org/docs/flask-restless/en/latest/quickstart.html |
This comment has been minimized.
This comment has been minimized.
|
Nice work! |
This comment has been minimized.
This comment has been minimized.
|
There are a few solutions I've seen, depending on the use case:
I'll work on some short examples for each of these solutions to add to the docs on extensions. |
This comment has been minimized.
This comment has been minimized.
|
Closing as this issue is OLD. |
This comment has been minimized.
This comment has been minimized.
|
keeping open as this seems important |
We do not encourage people to create more than one database connection and to connect to databases in arbitrary extensions. The obvious exception are extensions whose sole purpose is to connect to databases. Dependency resolving is done by the developer. Eg:
The problem comes with blueprints. If SomethingElse wants to define models it has to do that at a local scope where it has the reference to the db. Assuming it provides blueprints, how does the blueprint's views and other code get to the models? The sad truth is that if you make up blueprints on the fly the views in that blueprint don't know how to reference it.