Ticket #1655 (assigned defect)

Opened 8 months ago

Last modified 2 months ago

Create some kind of "component" archetecture for TG2

Reported by: mramm Assigned to: plewis (accepted)
Priority: normal Milestone: 2.0
Component: TurboGears Version: trunk
Severity: normal Keywords:
Cc:

Description

Django has mini apps inside of a "project" so your website could be made up of a blog-app, a wiki app, a forum app, etc. And it has some helpers to make this nice, automtic discovery of models, etc.

Basically this is implemented as apps directories inside your django project, which you configure URL's to and they dispatch from there. Apps contain controllers, templates, and models. User modification of the apps is then easy because they are just code in your project. But syncing up to a newer version of the blog-app is difficult.

In TG2 this could be accomplished by creating a components directory, putting components in there, and having the init on the controller of a component will register the models in the app (and can take setup parameters). So if you mount a blog component in 4 different places it can be configured 4 different ways by passing in different defaults when you instantiate the component's root controller object...

Change History

01/12/08 10:02:43 changed by mramm

At CodeMash? there was quite a bit of discussion on this topic:

Django user contributed apps are one of the main reasons people use django (another is the django admin).

TurboGears has most of the infrastructure to make this as easy as it is in django, but there have been some reservations about doing it, and we definitely have not created project and social structures to encourage the development of reusable application components.

One thing people have been concerned about is copying these components into the project directory. This is definitely the easy way to do it, and it is the way Django works. But there are potential issues because your project becomes totally divorced from upstream fixes to the app...

We could do some kind of 3-way-merge thing to help this out. Either using code from mercurial, or mercurial itself.

02/08/08 15:08:42 changed by khorn

The "obvious" way to accomplish something like this, to me, would be to leverage setuptools (which is likely installed on most machines running TG anyway).

Couldn't we establish a "tg2app" entry point, and then have a loadTGApp() function.

So you would ideally have something like:

RootController?():

blog = loadTGApp('blog_app') wiki = loadTGApp('wiki_app')

the loadTGApp() function (or class or whatever) would search the setuptools entrypoint for apps registering that name, and then load them.

I'm sure it sounds easier than it will end up being, but I think this would be a nice way to handle the "multiple app" problem.

Also, in your "main" app, you could just require the 'blog_app', 'wiki_app', etc. packages and let setuptools get the latest ones for you.

02/27/08 10:55:01 changed by mramm

  • milestone changed from 2.0 to 2.0-preview-2.

04/19/08 09:40:03 changed by mramm

  • milestone changed from 2.0-preview-2 to 2.0.

05/25/08 16:53:36 changed by plewis

  • owner changed from anonymous to plewis.
  • status changed from new to assigned.

05/27/08 03:56:57 changed by plewis

06/19/08 22:48:40 changed by mramm

  • milestone changed from 2.0 to 2.0-preview-2.

We should evaluate silverplate as a potential start on this problem.

Also, we should break this down into some smaller steps if possible.

07/06/08 20:49:57 changed by mramm

  • milestone changed from 2.0-preview-2 to 2.0.