def __call__(self): request = self.request principal = request.principal if not IUnauthenticatedPrincipal.providedBy(principal): notifications = getAdapter( self.context, IContentNotification, 'topic') if notifications.isSubscribed(principal.id): notifications.unsubscribe(principal.id) IStatusMessage(request).add(_('You have been unsubscribed.')) else: notifications.subscribe(principal.id) IStatusMessage(request).add(_('You have been subscribed.')) request.response.redirect('.') return u''
def update(self): context = self.context request = self.request profile = IPersonalProfile(context, None) if profile is not None: space = profile.space if space: self.profile = '%s/'%absoluteURL(space, request) self.title = profile.title self.avatar = profile.avatarUrl(request) else: self.title = _(u'Unknown')