Something I've noticed about the user_passes_test decorator is it does not
cache. While I can see data-freshness being an issue (ie if you change a
permission and the old result has to expire before the permission is
applied) a complex test can cause quite a bit of database IO and slow things
down on a busy site.

I started this StackOverflow thread, trying to get some answers on how I
might implement this myself:
http://stackoverflow.com/questions/2086420/caching-non-view-returns/

It's close to having a proper answer but I'm not sure on the best way to
form a cache key from a test instance. It has to include the user, the
function (or a pickle of it)... But how you do that efficiently is somewhat
beyond me at the moment.

If you've got a brain and can see a way to implement caching into
user_passes_test, please let me know.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply via email to