def index(self, model): """ See IACLPathCache. """ for obj in lineage(model): acl = getattr(obj, '__acl__', None) if acl is not None: self._index[self._getPath(obj)] = acl[:]
def _getPath(self, model): rpath = [] for location in lineage(model): if location.__name__ is None: break rpath.insert(0, location.__name__) return tuple(rpath)
def render_sidebar(self): """Render the sidebar appropriate for the context.""" for ancestor in lineage(self.context): r = queryMultiAdapter((ancestor, self.request), ISidebar) if r is not None: return r(self) # no sidebar exists for this context. return ""
def render_footer(self): """Render the footer appropriate for the context.""" for ancestor in lineage(self.context): r = queryMultiAdapter((ancestor, self.request), IFooter) if r is not None: return r(self) # no footer exists for this context, use the default. return DefaultFooter(self.context, self.request)(self)
def lookup(self, model, permission=None): """ See IACLPathCache. """ aces = [] for obj in lineage(model): path = self._getPath(obj) acl = self._index.get(path) if acl is None: acl = getattr(obj, '__acl__', ()) if acl: self._index[path] = acl if permission is not None: acl = [x for x in acl if x[2] == permission or isinstance(x[2], AllPermissionsList)] aces.extend(acl) if [x for x in acl if x[1] is Everyone]: break return aces
def get_containment(object, defaults): ifaces = set() for ancestor in lineage(object): ifaces.update(get_interfaces(ancestor, ())) return ifaces