Beispiel #1
0
 def test_imported_objects_can_be_saved(self):
     data = "somewhere::Over the rainbow"
     objects = self.parse_to_objects(data)
     for obj in objects:
         bulkimport.reset_object_foreignkeys(obj)
         print(repr(obj))
         obj.save()
Beispiel #2
0
Datei: bulk.py Projekt: hmpf/nav
def bulk_save(importer):
    """Saves the bulk data stored in the importer"""
    saved = []
    for _, objects in importer:
        if not isinstance(objects, BulkParseError):
            for obj in objects:
                reset_object_foreignkeys(obj)
                obj.save()
            saved.append(objects)
    return saved
Beispiel #3
0
def bulk_save(importer):
    """Saves the bulk data stored in the importer"""
    saved = []
    for _, objects in importer:
        if not isinstance(objects, BulkParseError):
            for obj in objects:
                reset_object_foreignkeys(obj)
                obj.save()
            saved.append(objects)
    return saved
Beispiel #4
0
    def test_created_objects_can_be_saved(self):
        data = 'myroom:10.0.90.10:myorg:SRV:::fileserver::WEB:UNIX:MAIL'
        objects = self.parse_to_objects(data)

        self.assertNotIsInstance(objects, Exception,
                                 msg='Got exception instead of object list')

        for obj in objects:
            bulkimport.reset_object_foreignkeys(obj)
            print(repr(obj))
            obj.save()