views:

35

answers:

1

In my urlconf, i have:

url(r'^sssssh/(.*)', staff_only_app.site.root),

What I'd like to do is limiting any access to this application to superusers. I tried this:

url(r'^sssssh/(.*)', user_passes_test(staff_only_app.site.root, lambda u: u.is_superuser)),

But it complains that decorate takes exactly 1 argument, and I gave two.

I'm thinking about currying the decorator via functools.partial, but thought I may be missing some more obvious solution.

+1  A: 

Write a decorator similar to Django's login_required or f.ex. this one http://djangosnippets.org/snippets/254/ and decorate the view.

zalew