Google Groups

Page performance and view permission

Greg M Jan 10, 2012 8:22 AM
Posted in group: django CMS developers
Hello -

I'm trying to tune our Django CMS installation and have run across one query in particular that is difficult to prevent.  (I'm using Django CMS 2.2.)  From cms/models/

is_restricted = PagePermission.objects.for_page(self).filter(can_view=True).exists()

As far as I can see this code is in the critical path for every page view, and in my case returns False (cms_pagepermission is empty.)  Neither the CMS_PERMISSION setting nor the CMS_PUBLIC_FOR setting appears to control whether or not has_view_permission is called, so there's no way to disable this.  I also tried fiddling with CMS_CACHE_DURATIONS, but I think this only caches for logged in users, not anonymous sessions.

Any suggestions on how I can avoid this query?  Can is_restricted be cached per page based on CMS_CACHE_DURATIONS['permissions']?