<commit_before>class ProgrammingError(Exception):
    """Somebody made a mistake in the code."""


# Just importing monkeypatch does the trick - don't remove this line
from kitsune.sumo import monkeypatch<commit_msg>Add post_migrate receiver to create permissions<commit_after>class ProgrammingError(Exception):
    """Somebody made a mistake in the code."""


# Just importing monkeypatch does the trick - don't remove this line
from kitsune.sumo import monkeypatch


from south.signals import post_migrate


# Courtesy of http://devwithpassion.com/felipe/south-django-permissions/
def update_permissions_after_migration(app, **kwargs):
    """Update app permission just after every migration.

    This is based on app django_extensions update_permissions management
    command.
    """
    from django.conf import settings
    from django.db.models import get_app, get_models
    from django.contrib.auth.management import create_permissions

    create_permissions(
        get_app(app), get_models(), 2 if settings.DEBUG else 0)


post_migrate.connect(update_permissions_after_migration)
{'fraction_non_alphanumeric': 0.07136322049405307, 'fraction_numerical': 0.0018298261665141812, 'mean_word_length': 4.788359788359788, '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': '6925748', 'n_tokens_mistral': 311, 'n_tokens_neox': 285, 'n_words': 98}