示例#1
0
    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''
示例#2
0
    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')