On Thu, Jan 8, 2009 at 11:48 AM, Christophe de Vienne
<[email protected]> wrote:
>
> Hi,
>
> I wrote a decorator to handle this issue. To use it one simply have to
> write :
>
> class TestFoo(TestController):
>    @with_identity('manager', password='managepass')
>    def test_bar(self):
>        pass
>
> The decorator :
>
> def with_identity(username, password=None):
>    def entangle(fn):
>        def new_fn(self, *args, **kw):
>            login_response = self.app.get('/login_handler', dict
> (login=username, password=password))
>            fn(self, *args, **kw)
>            logout_response = self.app.get('/logout_handler')
>
>        new_fn.__name__ = fn.__name__
>        return new_fn
>    return entangle

Nice. I think we should include this in standard (and with an example
usage in the quickstarted app)... This would be a nice sprint-task for
this weekend.

Florent.

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