def _onCreate(self, entity): """Sends out a message notifying users about the new invite/request. """ if entity.status == 'group_accepted': # this is an invite notifications.sendInviteNotification(entity) elif entity.status == 'new': # this is a request notifications.sendNewRequestNotification(entity) super(Logic, self)._onCreate(entity)
def _updateField(self, entity, entity_properties, name): """Called when the fields of the request are updated. Sends out a message depending on the change of status. """ value = entity_properties[name] if name == 'status' and entity.status != value: if value == 'group_accepted': # this is an invite notifications.sendInviteNotification(entity) elif value == 'new': # this is a request notifications.sendNewRequestNotification(entity) return super(Logic, self)._updateField(entity, entity_properties, name)