thanks for reminding me to keep things simple. i will keep the models and migrations in my project right now. i'll try to keep it modular and then figure out how to share it when i have my second project. hopefully, by then i would be more knowledgeable.
On Feb 12, 5:16 am, Daniel Fetchinson <[email protected]> wrote: > > i am confused about the terminology between plugins vs wsgi middleware > > vs components vs extensions. the discussions and documentation varies > > between tg1 and tg2, so please advise on which term i should google to > > achieve what i am trying to do. > > > i want to extend my models to be "taggable", or "commentable", or > > "rateable". i am ok with either installing/or building a tagging > > "plugin". it basically enables my projects to tag my objects and > > extends my objects so that i could call obj.tags() to get a list of > > tags. ideally, this could be an egg which i install. then in my > > project created the necessary tables, import the modules/libraries, > > and i am ready to go. > > > between reading (and still digesting) pep333, the tg2 trac ticker > > #1655 on "components", and the tgext extensions, i am confused between > > the approaches and what the distinctions are... my guess would be the > > wsgi middleware, b/c the #1655 ticket seems to talk about apps more > > like catwalk and tg-admin, whereas i m just trying to extend my > > models. but i am really not sure. if someone could point me in the > > right direction, it would be much much appreciated. > > Hi, I needed a similar thing too, I wanted my objects to be > commentable. First, I thought about an overarching solution, similarly > to what you describe, namely that I write the apps without comments > and then do some black magic and all apps turn into "commentable apps" > i.e. the objects will have the right attributes, the right tables and > relationships are created automagically and queries like obj.comments( > ) suddenly work because they issue the right joins. > > After some thought I abandoned this great scheme though. Since > ultimately you want to do something with the comments and inevitable > it will depend on the app what you want to do with them. The business > logic will inevitably enter the comment system too, it's just not > possible, I think, to abstract the whole thing away. Probably it's > actually possible, but I don't think it's very useful. > > So after all I ended up coding the comment system right into the apps. > There are lots of stuff one can factor out thought, for example all my > model objects that need comments inherit from a class called > commentMixin and this class is the same for all apps that need this > feature. This mixin provides the common attributes like 'get all > comments', 'get last comment', 'count all comments', etc, etc. So it's > still DRY but it doesn't work in a way that I write the app without > comments, install its egg, install also the comment system egg and > then automagically everything works. > > HTH, > Daniel > > -- > Psss, psss, put it down! -http://www.cafepress.com/putitdown -- 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.

