def __call__(self, context): if isinstance(context, dict): context = context.get('context') while not IPreferenceGroup.providedBy(context): context = context.__parent__ if context is None: return Vocabulary(()) terms = [] configlet = getUtility(IAvatarConfiglet) principal = context.__principal__ profile = IPersonalProfile(principal) if profile.avatarImage: terms.append(SimpleTerm(0, '0', '0')) if configlet.enabled: ids = getUtility(IIntIds) for name, avatar in configlet.items(): id = ids.queryId(avatar) terms.append(SimpleTerm(id, str(id), str(id))) return Vocabulary(terms)
def update(self): super(Navigation, self).update() context = self.context self.isRoot = IRootPreferences.providedBy(context) if self.isRoot: return path = [] parent = context while IPreferenceGroup.providedBy(parent): path.insert(0, parent) parent = parent.__parent__ self.root, path = path[0], path[1:] self.data = self._process(self.root, path)
def update(self): super(ProfileActions, self).update() context = self.context if not checkPermission('zojax.ModifyPreference', context): return path = [] parent = context while IPreferenceGroup.providedBy(parent): path.insert(0, parent) parent = parent.__parent__ self.root, path = path[0], path[1:] if not path: path = [self.root] self.data = self._process(self.root, path)