src/reversion/models.py
def safe_revert(versions):
    """
    Attempts to revert the given models contained in the give versions.

    This method will attempt to resolve dependencies between the versions to revert
    them in the correct order to avoid database integrity errors.
    """
    unreverted_versions = []
    for version in versions:
        try:
            with transaction.atomic():
                version.revert()
        except (IntegrityError, ObjectDoesNotExist):  # pragma: no cover
            unreverted_versions.append(version)
    if len(unreverted_versions) == len(versions):  # pragma: no cover
        raise RevertError('Could not revert revision, due to database integrity errors.')
    if unreverted_versions:  # pragma: no cover
        safe_revert(unreverted_versions)

    Attempts to revert the given models contained in the give versions.

    This method will attempt to resolve dependencies between the versions to revert
    them in the correct order to avoid database integrity errors.
    
Attempts to revert the given models contained in the give versions.
This method will attempt to resolve dependencies between the versions to revert
them in the correct order to avoid database integrity errors.
Attempts to revert the given models contained in the give versions . This method will attempt to resolve dependencies between the versions to revert them in the correct order to avoid database integrity errors .
def safe_revert(versions):
    unreverted_versions = []
    for version in versions:
        try:
            with transaction.atomic():
                version.revert()
        except (IntegrityError, ObjectDoesNotExist):  
            unreverted_versions.append(version)
    if len(unreverted_versions) == len(versions):  
        raise RevertError('Could not revert revision, due to database integrity errors.')
    if unreverted_versions:  
        safe_revert(unreverted_versions)
def safe_revert ( versions ) : unreverted_versions = [ ] for version in versions : try : with transaction . atomic ( ) : version . revert ( ) except ( IntegrityError , ObjectDoesNotExist ) : unreverted_versions . append ( version ) if len ( unreverted_versions ) == len ( versions ) : raise RevertError ( 'Could not revert revision, due to database integrity errors.' ) if unreverted_versions : safe_revert ( unreverted_versions )
Attempts to revert the given models contained in the give versions.
Attempts to revert the given models contained in the give versions .
"""
    Attempts to revert the given models contained in the give versions.

    This method will attempt to resolve dependencies between the versions to revert
    them in the correct order to avoid database integrity errors.
    """ # pragma: no cover # pragma: no cover # pragma: no cover
versions