<commit_before># -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-01-12 13:49
from __future__ import unicode_literals

from django.db import migrations
from django.utils import translation
from django.conf import settings


def update_review_accept_acknowledgement(apps, schema_editor):
    SettingValue = apps.get_model('core', 'SettingValue')
    setting_values = SettingValue.objects.filter(
        setting__group__name='email',
        setting__name='review_accept_acknowledgement',
    )
    # Loop over all SettingValues and update all of the value strings for each available language.
    for setting_value in setting_values:
        for language in settings.LANGUAGES:
            value_string = 'value_{}'.format(language[0])

            if setting_value and hasattr(setting_value, value_string):
                old_string = getattr(
                    setting_value,
                    value_string,
                )
                if old_string:

                    for replacement in (
                        ('{{ request.user.signature }}', '{{review_assignment.editor.signature|safe}}'),
                        ('{{ request.user.signature|safe }}', '{{review_assignment.editor.signature|safe}}')
                    ):
                        old_string = old_string.replace(*replacement)

                    setattr(
                        setting_value,
                        value_string,
                        old_string,
                    )
                    setting_value.save()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0062_merge_20220110_1934'),
    ]
<commit_msg>#2697 added whitespace to replacement val<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-01-12 13:49
from __future__ import unicode_literals

from django.db import migrations
from django.utils import translation
from django.conf import settings


def update_review_accept_acknowledgement(apps, schema_editor):
    SettingValue = apps.get_model('core', 'SettingValue')
    setting_values = SettingValue.objects.filter(
        setting__group__name='email',
        setting__name='review_accept_acknowledgement',
    )
    # Loop over all SettingValues and update all of the value strings for each available language.
    for setting_value in setting_values:
        for language in settings.LANGUAGES:
            value_string = 'value_{}'.format(language[0])

            if setting_value and hasattr(setting_value, value_string):
                old_string = getattr(
                    setting_value,
                    value_string,
                )
                if old_string:

                    for replacement in (
                        ('{{ request.user.signature }}', '{{ review_assignment.editor.signature|safe }}'),
                        ('{{ request.user.signature|safe }}', '{{ review_assignment.editor.signature|safe }}')
                    ):
                        old_string = old_string.replace(*replacement)

                    setattr(
                        setting_value,
                        value_string,
                        old_string,
                    )
                    setting_value.save()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0062_merge_20220110_1934'),
    ]

{'fraction_non_alphanumeric': 0.08696951583980873, 'fraction_numerical': 0.02211595935445308, 'mean_word_length': 1.9308231173380035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6954003', 'n_tokens_mistral': 913, 'n_tokens_neox': 806, 'n_words': 187}