Exemplo n.º 1
0
def SubscriberFollowed(obj,event):
    mp = getToolByName(obj,'portal_membership')
#     import pdb
#     pdb.set_trace()
    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 not (uuid in fwlist):
        fwlist.append(uuid)   
        userobject.setProperties(myfollow=fwlist)
        
    if Iquestion.providedBy(obj) and not(uuid in fwqlist):
        fwqlist.append(uuid)   
        userobject.setProperties(myfollowquestion=fwqlist)        
    if Itopic.providedBy(obj) and not(uuid in fwtlist):
        fwtlist.append(uuid)   
        userobject.setProperties(myfollowtopic=fwtlist)         
        
    evlute = IFollowing(obj)    
    if  evlute.available(username):
        evlute.addFollow(username)
        obj.followernum = evlute.followerNum
        obj.reindexObject()