Christopher Arndt wrote:
Adam Jones schrieb: > There is only a slight problem though, we wanted to use > "http://www.example.com/$username" as the url, not /sample. To solve > this you should probably look into CherryPy filters, which are designed > for this sort of thing. I don't think that you need filters for this. If URLs like the following are ok: http://myserver.com/users/foo http://myserver.com/users/foo/files/myfile then you could do the following (untested): - Code a secured subcontroller like Adam suggested that checks that the user is not anonymous. - Mount this subcontroller in your root controller: class Root(controllers.RootController): users = UsersController() - Make the subcontroller have a default method like this:
<snip> I completely forgot about this solution, and it is definitely a good way to go about it. One thing you might want to note is that if your "action" controllers return a tg_template key in their dictionary you don't have to use the expose decorator to assign a template to them (which also publishes them in the controller). This is nice in that you don't have to worry about name collision between a user name and one of your action methods. Since users will never be accessing that directly it doesn't make sense to have it available anyways. -Adam --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

