Closed santhoshtr closed 10 years ago
@santhoshtr By keeping all modules inside modules folder aren't we duplicating the code? I understand about template.html but how about providing getTemplate function but making this way will make it difficult to use Flask because currently whole SILPA is routed from flask routing methods. Do you have any idea for fixing this?
@copyninja,I think the Blueprint class from flask can be used to achieve separating the templates from the main app http://flask.pocoo.org/docs/blueprints/ This blogpost illustrates this with an example http://mostovenko.blogspot.in/2012/04/flask-lightweight-and-awesome-adding-ui.html
simple_page = Blueprint('simple_page', __name__, template_folder='templates')
these blueprint instances can be packaged with both the modules and silpa as dependencies. But the routing in silpa-flask will have to rewritten
Even though python modules are separated well, still the silpa application knows about them because in templates folder we have templateXYZ.html. Even if a module does not exist, the template exists inside templates folder. I propose further decoupling like this:
__init__.py
- that has import statement for the module- it can be from python path or relative pathThen all modules can be loaded with following (example) code:
but the silpa.conf configuration for turing off/on the modules can still exist.
Also think about an absolute structure for packaging all these. We will have
Both of the above does not know each other, no dependencies with them. If we define a simple bridge package says python-silpa-spellchecker with dependency to both of them and having setup script to register the python application in silpa - by adding some configuration and template to a predefined system path... I think that makes things easier.