Hi list,

I've looked through the documentation as well as some parts of the
source but didn't find it anywhere. Basically, the question is how do
I refactor common tasks like creating certain objects from GET
variables that is required for every exposed method of my Root
controller.

For instance if each and every method requires a GET variable
referencing an object in a database, at the moment I validate this
variable, fetch the corresponding object from the db at the beginning
of every method. Where can I put this piece of code so that the object
is available for every method? My feeling is that the variable should
be passed to the __init__ of the RootController, there the necessary
validation and object fetching should be done and then the object
should be put into an instance variable where each method can find it.
But I don't quite know how exactly a RootController is instantiated.

Example: the app in question is a collection of blogs and every user
must specify which blog he/she wants to view. This variable -- the one
specifying the blog -- will be the first argument of every exposed
method and it should be validated and the corresponding blog object
should be fetched from the db and it should be readily available to
every method.

What's the best tg idiom for this?

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to