Ticket #2191: messaging.diff
| File messaging.diff, 2.9 kB (added by exarkun, 2 years ago) |
|---|
-
Blendix/blendix/blendix_model.py
old new 480 480 creation of new blips that the owner of this powerup is interested in. 481 481 """) 482 482 483 messageQueue = dependsOn(MessageQueue) 484 483 485 def activate(self): 484 486 """ 485 487 Initialize in-memory attributes. … … 684 686 685 687 @rtype: C{NoneType} 686 688 """ 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) 689 692 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() 690 701 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 691 730 def _getShare(self, person): 692 731 """ 693 732 Find the L{Share} associated with the given L{Person} for the everyone … … 729 768 Find an existing L{BlendixPerson} associated with the given L{Person} 730 769 and update its I{name} attribute. 731 770 """ 771 732 772 blendixPerson = self._blendixPersonForPerson(person) 733 773 if blendixPerson is not None: 734 774 blendixPerson.name = person.name
