@atomic
def create_version_for_upload(addon, upload, channel):
 fileupload_exists = addon.fileupload_set.filter(created__gt=upload.created, version=upload.version).exists()
 version_exists = Version.unfiltered.filter(addon=addon, version=upload.version).exists()
 if (fileupload_exists or version_exists):
  log.info('Skipping Version creation for {upload_uuid} that would  cause duplicate version'.format(upload_uuid=upload.uuid))
 else:
  from olympia.devhub.views import auto_sign_version
  log.info('Creating version for {upload_uuid} that passed validation'.format(upload_uuid=upload.uuid))
  beta = (bool(upload.version) and is_beta(upload.version))
  version = Version.from_upload(upload, addon, [amo.PLATFORM_ALL.id], channel, is_beta=beta)
  if ((addon.status == amo.STATUS_NULL) and (channel == amo.RELEASE_CHANNEL_LISTED)):
   addon.update(status=amo.STATUS_NOMINATED)
  auto_sign_version(version, is_beta=version.is_beta)

@ atomic def create_version_for_upload ( addon , upload , channel ) : fileupload_exists = addon . fileupload_set . filter ( created__gt = upload . created , version = upload . version ) . exists ( ) version_exists = Version . unfiltered . filter ( addon = addon , version = upload . version ) . exists ( ) if ( fileupload_exists or version_exists ) : log . info ( 'Skipping Version creation for {upload_uuid} that would  cause duplicate version' . format ( upload_uuid = upload . uuid ) ) else : from olympia . devhub . views import auto_sign_version log . info ( 'Creating version for {upload_uuid} that passed validation' . format ( upload_uuid = upload . uuid ) ) beta = ( bool ( upload . version ) and is_beta ( upload . version ) ) version = Version . from_upload ( upload , addon , [ amo . PLATFORM_ALL . id ] , channel , is_beta = beta ) if ( ( addon . status == amo . STATUS_NULL ) and ( channel == amo . RELEASE_CHANNEL_LISTED ) ) : addon . update ( status = amo . STATUS_NOMINATED ) auto_sign_version ( version , is_beta = version . is_beta )
note this function is only used for api uploads .