<commit_before>from django import forms
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.utils.html import escape

from publicbody.models import PublicBody
from foirequest.models import FoiRequest, FoiLaw

new_publicbody_allowed = settings.FROIDE_CONFIG.get(
        'create_new_publicbody', False)
publicbody_empty = settings.FROIDE_CONFIG.get('publicbody_empty', True)
payment_possible = settings.FROIDE_CONFIG.get('payment_possible', False)
payment_possible = settings.FROIDE_CONFIG.get('payment_possible', False)


class RequestForm(forms.Form):
    public_body = forms.CharField(label=_("Public Body"), required=False)
    law = forms.IntegerField(label=_("FOI Law"), widget=forms.HiddenInput,
            required=False)
    subject = forms.CharField(label=_("Subject"),
            widget=forms.TextInput(attrs={'placeholder': _("Subject")}))
    body = forms.CharField(label=_("Body"), 
            widget=forms.Textarea(
            attrs={'placeholder': _("Specify your request here...")}))
    public = forms.BooleanField(required=False, initial=True,
            label=_("This request will be public immediately."))

    def clean_public_body(self):
        pb = self.cleaned_data['public_body']
        if pb == "new":
            if not new_publicbody_allowed:
                raise forms.ValidationError(
                        _("You are not allowed to create a new public body"))
        elif pb == "":
            if not publicbody_empty:<commit_msg>remove duplicated var definition<commit_after>from django import forms
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.utils.html import escape

from publicbody.models import PublicBody
from foirequest.models import FoiRequest, FoiLaw

new_publicbody_allowed = settings.FROIDE_CONFIG.get(
        'create_new_publicbody', False)
publicbody_empty = settings.FROIDE_CONFIG.get('publicbody_empty', True)
payment_possible = settings.FROIDE_CONFIG.get('payment_possible', False)


class RequestForm(forms.Form):
    public_body = forms.CharField(label=_("Public Body"), required=False)
    law = forms.IntegerField(label=_("FOI Law"), widget=forms.HiddenInput,
            required=False)
    subject = forms.CharField(label=_("Subject"),
            widget=forms.TextInput(attrs={'placeholder': _("Subject")}))
    body = forms.CharField(label=_("Body"), 
            widget=forms.Textarea(
            attrs={'placeholder': _("Specify your request here...")}))
    public = forms.BooleanField(required=False, initial=True,
            label=_("This request will be public immediately."))

    def clean_public_body(self):
        pb = self.cleaned_data['public_body']
        if pb == "new":
            if not new_publicbody_allowed:
                raise forms.ValidationError(
                        _("You are not allowed to create a new public body"))
        elif pb == "":
            if not publicbody_empty:
{'fraction_non_alphanumeric': 0.10618892508143322, 'fraction_numerical': 0.0, 'mean_word_length': 3.625, 'pattern_counts': {'":': 4, '<': 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': '4481210', 'n_tokens_mistral': 838, 'n_tokens_neox': 842, 'n_words': 203}