Hi all, sorry for all these n00b questions but I still haven't got the 'right' way of using tg I guess.
I have a mod_python application that I would like to port to tg. I wrote the mod_python app in such a way that (roughly) every page is a separate class and it gets instantiated upon every request. And there is some amount of setup code that gets triggered by every request and is the same for every request (opening log files, connecting to db, checking identity, etc). This common setup code I put into the __init__ of a 'main' class and every class corresponding to a page subclasses this 'main' class. In this way I only needed to write the setup code of a request once and it gets executed for every request (because every request instantiates a page class). Now with tg things are different because exposed objects are methods and not classes so I don't quite know what is the best idiom to write setup code only once and have it executed for every request. Decorators are cool but I can't pass anything to it that is specific to a request (like usernames and GET/POST variables). This was also different with mod_python because there every function/method/class that is exposed has access to the request object and can get stuff from there. Right now I put all setup code this into a function and copy the function call to the beginning of each and every method. This seems very redundant. What do others do? Cheers, Daniel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

