Hi, I have a couple ideas I want to discuss before getting my hands
dirty implementing them (to avoid another "validate" fiasco ;)
1) "response" at a StackedObjectProxy in TG2?
Currently the Reponse is built in the render_response method leaving
no way of altering it in the controller methods' body. This will make
hard the implementing things which need to set additional headers on
it (flash comes to mind).
To mimic 1.0's API more closely I think it would be a good idea to
initialize the Response before the controller method is called and
push it into a StackedOB so controllers could do things like:
def controllermethod(self):
tg.response.headers["Foo"] = "bar"
An alternative could be to inject it into the method's parameters if
a special "tg_response" argument in a similar way "tg_errors" are
injected in TG 1.0. However, this would make the "flash" API a little
un-nicier since the response will need to be passed explicitly.
I think the "global" response leaves room for a nicer API.
2) I'd also like to extract a couple of methods from the "route"
method so they can be easily subclassed. The first methods that comes
to mind is "validate" , "lookup_controller" and "render".
However, in order for Pylons' dispatcher not to "expose" them, they
need to be prefixed with an underscore. The problem with this is that
it's not obvious that those methods should/could be overrided by
subclasses since a leading underscore is a python idiom to mark a
method private. Another problem is that api docs generators will
probably ignore them when documenting the public API.
So I'm looking for suggestions on this... some ideas:
1) tweak the dispatcher so it never calls those methods, even though
they're not underscore prefixed.
2) come up with a prefix and document it, for example, _tg_validate,
_tg_lookup_controller, etc... we'll alose need to tweak the api
generator so it document's them.
3) ????
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---