Exemplo n.º 1
0
def SubscriberUnFollowed(obj,event):
    mp = getToolByName(obj,'portal_membership')
    userobject = mp.getAuthenticatedMember()
    username = userobject.getId()
    fwqlist = list(userobject.getProperty('myfollowquestion'))
    fwtlist = list(userobject.getProperty('myfollowtopic'))    
    fwlist = list(userobject.getProperty('myfollow'))

    uuid = IUUID(obj,None)
    if uuid == None:return
    if  (uuid in fwlist):
        fwlist.remove(uuid)
        userobject.setProperties(myfollow=fwlist)
    if Iquestion.providedBy(obj) and (uuid in fwqlist):
        fwqlist.remove(uuid)   
        userobject.setProperties(myfollowquestion=fwqlist)        
    if Itopic.providedBy(obj) and (uuid in fwtlist):
        fwtlist.remove(uuid)   
        userobject.setProperties(myfollowtopic=fwtlist)       
    
    evlute = IFollowing(obj)    
    if not evlute.available(username):
        evlute.delFollow(username)
        obj.followernum = evlute.followerNum
        obj.reindexObject()