Example #1
0
    def delete_related_entities(self, delete_self=False):
        """Permanently delete all related Photos and Notes, and also self if
        delete_self is True."""
        # Delete all related Notes.
        notes = self.get_notes(filter_expired=False)
        # Delete the locally stored Photos.  We use get_value_for_datastore to
        # get just the keys and prevent auto-fetching the Photo data.
        photo = Person.photo.get_value_for_datastore(self)
        note_photos = [Note.photo.get_value_for_datastore(n) for n in notes]

        entities_to_delete = filter(None, notes + [photo] + note_photos)
        if delete_self:
            entities_to_delete.append(self)
            if config.get('enable_fulltext_search'):
                full_text_search.delete_record_from_index(self)
        db.delete(entities_to_delete)
Example #2
0
    def delete_related_entities(self, delete_self=False):
        """Permanently delete all related Photos and Notes, and also self if
        delete_self is True."""
        # Delete all related Notes.
        notes = self.get_notes(filter_expired=False)
        # Delete the locally stored Photos.  We use get_value_for_datastore to
        # get just the keys and prevent auto-fetching the Photo data.
        photo = Person.photo.get_value_for_datastore(self)
        note_photos = [Note.photo.get_value_for_datastore(n) for n in notes]

        entities_to_delete = filter(None, notes + [photo] + note_photos)
        if delete_self:
            entities_to_delete.append(self)
            if config.get('enable_fulltext_search'):
                full_text_search.delete_record_from_index(self)
        db.delete(entities_to_delete)
 def test_delete_record_from_index(self):
     db.put(self.p4)
     full_text_search.add_record_to_index(self.p4)
     full_text_search.delete_record_from_index(self.p4)
     results = full_text_search.search('haiti', 'Miki', 5)
     assert not results
 def test_delete_record_from_index(self):
     db.put(self.p4)
     full_text_search.add_record_to_index(self.p4)
     full_text_search.delete_record_from_index(self.p4)
     results = full_text_search.search('haiti', 'Miki', 5)
     assert not results