I have created a new branch on launchpad under ~billferrett/web2py/
plugins.  The purpose is to demo an approach to using plugins to
provide functionality to the web2py core.

I needed an example area to apply the idea to so I have taken sql.py
and moved all the db-engine specific code (and some general SQL code)
replacing it with calls to the selected plugin class.

The plugins are found in plugins/db.  There is one "abstract" class
that acts as a template for "db" plugins and contains common
functions.  There is one plugin file/class for each db-engine.

On startup, sql.py looks for plugins in the plugins/db folder,
ignoring any containing IS_ABSTRACT=True and asking each plugin to
check that required drivers are present.  This information is
formatted so that widget.start() displays it in place of the normal
"Database drivers found".

When a SQLDB is created, the appropriate plugin is selected depending
on the uri.  This can be overridden if required.  The modified sql.py
then calls to the plugin to perform the necessary functions (get
dialect values, connect, create table, insert, update, delete, etc).

I have moved as much of the actual SQL to the plugins as was
practicable for the demo.  All the plugin code is complete but only
the basic functionality for sqlite and mysql has been tested (create
table, insert, update, delete).

As I say, this is intended as a demo of an approach that I think could
be useful.  I hope that some of you will have the time to look at it
and I look forward to your comments.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to