MCPcopy
hub / github.com/WebODM/WebODM / save

Method save

app/models/task.py:336–377  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

334 logger.warning("Could not move assets folder for task {}. We're going to proceed anyway, but you might experience issues: {}".format(self, e))
335
336 def save(self, *args, **kwargs):
337 if self.project.id != self.__original_project_id:
338 self.move_assets(self.__original_project_id, self.project.id)
339 self.__original_project_id = self.project.id
340
341 # Manually validate the fields we want,
342 # since Django's clean_fields() method obliterates
343 # our foreign keys without explanation :/
344 errors = {}
345 for f in self._meta.fields:
346 if f.attname in ["options"]:
347 raw_value = getattr(self, f.attname)
348 if f.blank and raw_value in f.empty_values:
349 continue
350
351 try:
352 setattr(self, f.attname, f.clean(raw_value, self))
353 except ValidationError as e:
354 errors[f.name] = e.error_list
355
356 if errors:
357 raise ValidationError(errors)
358
359 # Validate crop area
360 # must be enclosed within all raster extents
361 # and have a positive area
362 if self.crop is not None:
363 if self.crop.valid:
364 has_extents = False
365 for extent in [self.orthophoto_extent, self.dsm_extent, self.dtm_extent]:
366 if extent is not None:
367 has_extents = True
368 self.crop = extent.intersection(self.crop)
369 if not has_extents or self.crop.area <= 0:
370 self.crop = None
371 else:
372 self.crop = None
373
374 self.clean()
375 self.validate_unique()
376
377 super(Task, self).save(*args, **kwargs)
378
379 def get_extent(self):
380 if self.orthophoto_extent is not None:

Callers 15

handle_importMethod · 0.95
processMethod · 0.95
update_georef_fieldsMethod · 0.95
update_media_fieldMethod · 0.95
set_failureMethod · 0.95
update_sizeMethod · 0.95
postMethod · 0.45
import_filesFunction · 0.45
OeFunction · 0.45

Calls 1

move_assetsMethod · 0.95

Tested by 15

test_panorama_tilesMethod · 0.36
test_settingsMethod · 0.36
test_basemapMethod · 0.36
test_quotaMethod · 0.36
test_quotaMethod · 0.36
test_project_cleanupMethod · 0.36
test_flightpathMethod · 0.36
test_settingsMethod · 0.36
create_test_imageMethod · 0.36
test_viewsMethod · 0.36
test_tasksMethod · 0.36