Comment 2 for bug 252405

Revision history for this message
Jamu Kakar (jkakar) wrote :

The example I have is with code that checks an invitation:

class Invitation(object):

    def __init__(self):
        raise_event(InvitiationCreated)

    def accept(self):
        # Perform logic to accept invitation.
        Store.of(self).remove()
        raise_event(InvitiationRemoved)

    def reject(self):
        Store.of(self).remove()
        raise_event(InvitiationRemoved)

I know that Invitation's will only ever be removed from a store by
having their accept or reject method called. The purpose of this
bug is to make this possible:

class Invitation(object):

    def __init__(self):
        raise_event(InvitiationCreated)

    def __storm_remove__(self):
        raise_event(InvitiationRemoved)

    def accept(self):
        # Perform logic to accept invitation.
        Store.of(self).remove()

    def reject(self):
        Store.of(self).remove()

I hadn't thought of the coherency issue you mention, because it isn't
something that would ever happen in the case I have, but I can see that being
a big enough problem to avoid providing the feature.