def revert_exploration(committer_id, exploration_id, current_version, revert_to_version):
 exploration_model = exp_models.ExplorationModel.get(exploration_id, strict=False)
 if (current_version > exploration_model.version):
  raise Exception(('Unexpected error: trying to update version %s of exploration from version %s. Please reload the page and try again.' % (exploration_model.version, current_version)))
 elif (current_version < exploration_model.version):
  raise Exception(('Trying to update version %s of exploration from version %s, which is too old. Please reload the page and try again.' % (exploration_model.version, current_version)))
 exploration = get_exploration_by_id(exploration_id, version=revert_to_version)
 exploration_rights = rights_manager.get_exploration_rights(exploration.id)
 if (exploration_rights.status != rights_manager.ACTIVITY_STATUS_PRIVATE):
  exploration.validate(strict=True)
 else:
  exploration.validate()
 exp_models.ExplorationModel.revert(exploration_model, committer_id, ('Reverted exploration to version %s' % revert_to_version), revert_to_version)
 memcache_services.delete(_get_exploration_memcache_key(exploration_id))
 update_exploration_summary(exploration_id, None)

def revert_exploration ( committer_id , exploration_id , current_version , revert_to_version ) : exploration_model = exp_models . ExplorationModel . get ( exploration_id , strict = False ) if ( current_version > exploration_model . version ) : raise Exception ( ( 'Unexpected error: trying to update version %s of exploration from version %s. Please reload the page and try again.' % ( exploration_model . version , current_version ) ) ) elif ( current_version < exploration_model . version ) : raise Exception ( ( 'Trying to update version %s of exploration from version %s, which is too old. Please reload the page and try again.' % ( exploration_model . version , current_version ) ) ) exploration = get_exploration_by_id ( exploration_id , version = revert_to_version ) exploration_rights = rights_manager . get_exploration_rights ( exploration . id ) if ( exploration_rights . status != rights_manager . ACTIVITY_STATUS_PRIVATE ) : exploration . validate ( strict = True ) else : exploration . validate ( ) exp_models . ExplorationModel . revert ( exploration_model , committer_id , ( 'Reverted exploration to version %s' % revert_to_version ) , revert_to_version ) memcache_services . delete ( _get_exploration_memcache_key ( exploration_id ) ) update_exploration_summary ( exploration_id , None )
reverts an exploration to the given version number .