'Save version if there has been a change, trigger a rebuild'

def save_version(self, version):

    new_value = self.cleaned_data.get(('version-%s' % version.slug), None)
    privacy_level = self.cleaned_data.get(('privacy-%s' % version.slug), None)
    if (((new_value is None) or (new_value == version.active)) and ((privacy_level is None) or (privacy_level == version.privacy_level))):
        return
    version.active = new_value
    version.privacy_level = privacy_level
    version.save()
    if (version.active and (not version.built) and (not version.uploaded)):
        trigger_build(project=self.project, version=version)
