Ticket #2191: messaging.diff

File messaging.diff, 2.9 kB (added by exarkun, 2 years ago)

that diff we were looking at

  • Blendix/blendix/blendix_model.py

    old new  
    480480        creation of new blips that the owner of this powerup is interested in. 
    481481        """) 
    482482 
     483    messageQueue = dependsOn(MessageQueue) 
     484 
    483485    def activate(self): 
    484486        """ 
    485487        Initialize in-memory attributes. 
     
    684686 
    685687        @rtype: C{NoneType} 
    686688        """ 
    687         self._blendixPersonForPerson(person).deleteFromStore() 
    688         sharing.unShare(person) 
     689        # What I think this method was previously doing: 
     690#         self._blendixPersonForPerson(person).deleteFromStore() 
     691#         sharing.unShare(person) 
    689692 
     693        # What I believe this method intended to be doing previously: 
     694#         while 1: 
     695#             blendixPerson = self._blendixPersonForPerson(person) 
     696#             if blendixPerson is None: 
     697#                 break 
     698#             person.store.query( 
     699#                 for the share associated with blendixPerson 
     700#             ).deleteFromStore() 
    690701 
     702        # Ported to xmantissa.messaging, sort of: 
     703        everyone = sharing.getEveryoneRole(person.share) 
     704        sender = Target(u'myshareid', u'mylocalpart', u'mydomain') 
     705        contentType = u'amp/personlookup+blendix' 
     706        contentBody = ( 
     707            '\x00\x04_ask'     '\x00\x011' 
     708            '\x00\x08_command' '\x00\x06delete' 
     709            '\x00\x00'         '\x00\x00') 
     710        for share in person.store.query( 
     711            Share, AND(Share.sharedItem == person, 
     712                       Share.sharedTo.oneOf(list(everyone.allRoles())))): 
     713 
     714            receipient = Target( 
     715                share.shareID, u'blendixlocalpart', u'blendixdomain') 
     716            self.messageQueue.queueMessage( 
     717                sender, recipient, contentType, contentBody) 
     718            # To be correct, share deletion needs to be  
     719            # If I wanted, I could use the consequence feature of queueMessage to 
     720            # delay unsharing until unindexing has happened.  This would avoid 
     721            # someone being in the index when they're not shared, which will 
     722            # probably be an error on some page somewhere.  However, that should 
     723            # just be handled gracefully.  I am making a policy decision that 
     724            # unsharing should happen instantly when the user requests it. -exarkun 
     725            share.deleteFromStore() 
     726 
     727 
     728 
     729 
    691730    def _getShare(self, person): 
    692731        """ 
    693732        Find the L{Share} associated with the given L{Person} for the everyone 
     
    729768        Find an existing L{BlendixPerson} associated with the given L{Person} 
    730769        and update its I{name} attribute. 
    731770        """ 
     771         
    732772        blendixPerson = self._blendixPersonForPerson(person) 
    733773        if blendixPerson is not None: 
    734774            blendixPerson.name = person.name 
jethro@divmod.org