Beispiel #1
0
def _remove_user_uploads_folder_if_empty(user):
    """
    Check if the user uploads folder is empty and removes it.
    Removes user uploads folder in the "local" disk and in mirrored disks too. 
    """
    user_uploads_dir = user.profile.locations()['uploads_dir']
    remove_directory_if_empty(user_uploads_dir)
    remove_empty_user_directory_from_mirror_locations(user_uploads_dir)
def _remove_user_uploads_folder_if_empty(user):
    """
    Check if the user uploads folder is empty and removes it.
    Removes user uploads folder in the "local" disk and in mirrored disks too. 
    """
    user_uploads_dir = user.profile.locations()['uploads_dir']
    remove_directory_if_empty(user_uploads_dir)
    remove_empty_user_directory_from_mirror_locations(user_uploads_dir)
Beispiel #3
0
def remove_empty_user_directory_from_mirror_locations(user_uploads_path):
    if settings.MIRROR_UPLOADS:
        for destination_base_path in settings.MIRROR_UPLOADS:
            remove_directory_if_empty(
                user_uploads_path.replace(settings.UPLOADS_PATH,
                                          destination_base_path))
Beispiel #4
0
def remove_empty_user_directory_from_mirror_locations(user_uploads_path):
    if settings.MIRROR_UPLOADS:
        for destination_base_path in settings.MIRROR_UPLOADS:
            remove_directory_if_empty(user_uploads_path.replace(settings.UPLOADS_PATH, destination_base_path))