> I'll tell you the truth, the app-based design is a big deal to me, so > much so that I'm strongly leaning towards moving to Django even though > in most other ways I prefer TG. I really think that TG very strongly > needs a clear, easy and well-documented way to plug in functionality > in packages to existing projects. I feel that it's a sin for something > that works so smoothly in using a PHP framework to be so hard to do in > a Python framework unless you have an excellent reason not to build in > the functionality.
This is very easy to do now in TG2 and TG -- except for the datamodel. And the django people haven't solved that problem particularly well either. The thing is that you need to create join tables for things like comments on posts and comments on pages and coments on messages, etc. This "connective tissue" is the stuff that hooks these apps together at the data layer, and it's the part that can't be in the individual apps. While you can design apps the reduce the amount of "connective tissue" that they have, and the Django people have pushed that model quite a bit, it has some significant performance and flexibility drawbacks. The other alternative is to put the connective tissue in by copying the app in, and hacking up it's model a bit to fit it into your system. This is also a method commonly used in the Django community. But it makes it hard to maintain apps, across versions, since new versions will have to be merged into your now modified code. Another solution is the one we started in TG2 which is to make as few assumptions about the model as we can in the rest of the application code, and then allow the user to configure their own model classes which meet those assumptions and place them into a known location on the config object. This takes extra work because we have to think through what the minimum interface requiremnt for that app's model is, and document it, but it's not hard to do. If you want to take a look at how this works in practice there's the silverplate app which provides user management for TG2 applications that use the standard tgext.authorization stuff. Another approach is to create a model factory that you can use to create the model classes you need dynamically based on some configuration information. This adds a little bit of complexity to creating the reusable app, but makes things much more flexible. And to the extent that you're apps have separate data that does not interact significantly, none of this is a problem at all, and all you need to do is make a module and put a app_root controller in there that you can import and instantiate in your root controller. ;) --Mark Ramm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

