Yes, that is another good example.  I think all of the problems with
the sub-app approach are very solvable:

1) Portability and separation:
There needs to be a Plugin class that is instantiated like Auth with
database, globals, etc. It should be separated completely from LOAD.
This will let the user determine which database the plugin system will
use.

plugin = Plugin(db,globals())

2) Order of execution:
Plugins are not executed until they are called. Once a plugin is
called, it's models are executed in the same order that web2py
executes app models

3) Plugin URL when in subfolder:
Plugins could be exposed in a similar fashion to Auth and Service
through an app controller. There would be a controller function that
serves plugins using request args. You could also call a load function
explicitly to render a plugin in a view.

def plugins:
    return plugin()

Plugin: appname/plugins/p3/controllers/default.py
URL: http://localhost:8000/appname/default/plugins/p3/default/

Or manually passing your own args
{{=plugin.load("comments",f="index",ajax_trap=True)}}

Basically, do it just like things are done in tools.py. Thoughts?

On Oct 23, 11:55 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Multiple DAL. If I wrote a script that HAS to connect to a mysql database,
> and a postgresql database at the same time.
>
> -Thadeus
>
> On Fri, Oct 23, 2009 at 11:32 PM, mr.freeze <nat...@freezable.com> wrote:
>
> > Massimo, in the video you assume that there are instances of DAL and
> > Crud that are named db and crud respectively.  This may not be the
> > case and doesn't seem portable.  Shouldn't their be a way to
> > instantiate a plugin with a user's current instances? (i.e. what if
> > they named their Crud instance mycrud and named DAL data?). Perhaps a
> > settings file for each plugin?
>
> > On Oct 22, 1:48 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > > One issue is models:
>
> > > Let's say we have a normal model
> > >    models/db.py
> > > and two plugin models in
> > >    plugins/p1/models/a.py
> > >    plugins/p1/models/x.py
> > >    plugins/p2/models/e.py
>
> > > In which order should they be executed? whatever order we use we would
> > > have to merge the results of multiple listdir and then sort them.
> > > Takes some extra time. Now that everything is one folder things are
> > > straightforward.
>
> > > Another issue is controllers? What would be the url for a function
> > > index in the controller below?
>
> > >    plugins/p3/controllers/default.py
>
> > > Mind that we cannot break backward compatibility!
>
> > > Massimo
>
> > > On Oct 22, 1:38 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > That's not as limiting as I thought at least.  Did you already try the
> > > > sub-app approach and hit obstacles or is it something that might be
> > > > worth prototyping so we can compare performance/benefits/drawbacks?
>
> > > > On Oct 21, 7:20 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > Yes you would be limited to one model file, one controller file but
> > as
> > > > > many views as you have actions and as many modules and static files
> > as
> > > > > you need.
>
> > > > > On Oct 21, 6:08 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > Man oh man! I've been at a SharePoint conference all day (hey, I
> > have
> > > > > > to make money!) so I'm still sifting through all of the discussion
> > but
> > > > > > I have another question: With the current implementation plugins
> > would
> > > > > > be limited to one view, one controller, one model, etc., because of
> > > > > > the naming convention, correct? If so, do you think this will be
> > too
> > > > > > constraining?
>
> > > > > > On Oct 21, 11:39 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > Physically plugins are not in the own folder because it would
> > make
> > > > > > > web2py very clunky, it would have to search for plugins in the
> > folder
> > > > > > > structure.
>
> > > > > > > Logically the are listed as separate.
>
> > > > > > > On Oct 21, 11:16 am, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > > > I like how the plugin system is shaping up but have one
> > question about
> > > > > > > > the folder structure. It seems more manageable to structure it
> > like
> > > > > > > > this:
>
> > > > > > > > applications
> > > > > > > > -- my app
> > > > > > > > ---- models
> > > > > > > > ---- views
> > > > > > > > ---- controllers
> > > > > > > > ---- plugins
> > > > > > > > ------ myplugin
> > > > > > > > -------- models
> > > > > > > > -------- views
> > > > > > > > -------- controllers
>
> > > > > > > > This way a plugin would basically be a sub-app, making it
> > easier to
> > > > > > > > install/uninstall/upgrade and could also have multiple
> > models/views/
> > > > > > > > controllers.  I remember some discussion about it but can't
> > remember
> > > > > > > > what the reasons against it were.
>
> > > > > > > > On Oct 21, 10:18 am, mdipierro <mdipie...@cs.depaul.edu>
> > wrote:
>
> > > > > > > > > The new web2py in trunk (1.68.2) also contains an improved
> > > > > > > > > experimental solution for plugins.
> > > > > > > > > Here is a new video about it
>
> > > > > > > > >http://www.vimeo.com/7182692
>
> > > > > > > > > It includes suggestions from various people but I am sure it
> > still
> > > > > > > > > needs a lot of work. Anyway, give it a try and let us know
> > what else
> > > > > > > > > would you expect from a plugin system.
>
> > > > > > > > > The interface for uploading/downloading plugins is missing,
> > among
> > > > > > > > > other things.
>
> > > > > > > > > Massimo- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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