예제 #1
0
파일: usercp.py 프로젝트: pombreda/Misago
class ChangeForumOptionsBaseForm(forms.ModelForm):
    timezone = forms.ChoiceField(
        label=_("Your current timezone"),
        choices=[],
        help_text=_("If dates and hours displayed by forums are inaccurate, "
                    "you can fix it by adjusting timezone setting."))

    is_hiding_presence = forms.YesNoSwitch(
        label=_("Hide my presence"),
        help_text=_("If you hide your presence, only members with permission "
                    "to see hidden will see when you are online."))

    limits_private_thread_invites_to = forms.TypedChoiceField(
        label=_("Who can add me to private threads"),
        coerce=int,
        choices=PRIVATE_THREAD_INVITES_LIMITS_CHOICES)

    subscribe_to_started_threads = forms.TypedChoiceField(
        label=_("Threads I start"), coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)

    subscribe_to_replied_threads = forms.TypedChoiceField(
        label=_("Threads I reply to"),
        coerce=int,
        choices=AUTO_SUBSCRIBE_CHOICES)

    class Meta:
        model = get_user_model()
        fields = [
            'timezone', 'is_hiding_presence',
            'limits_private_thread_invites_to', 'subscribe_to_started_threads',
            'subscribe_to_replied_threads'
        ]
예제 #2
0
class RolePermissionsForm(forms.Form):
    legend = _("Polls")

    can_start_polls = forms.TypedChoiceField(label=_("Can start polls"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Own threads")),
                                                      (2, _("All threads"))))
    can_edit_polls = forms.TypedChoiceField(label=_("Can edit polls"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Own polls")),
                                                     (2, _("All polls"))))
    can_delete_polls = forms.TypedChoiceField(label=_("Can delete polls"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Own polls")),
                                                       (2, _("All polls"))))
    poll_edit_time = forms.IntegerField(
        label=_("Time limit for own polls edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own polls."),
        initial=0,
        min_value=0)
    can_always_see_poll_voters = forms.YesNoSwitch(
        label=_("Can always see polls voters"),
        help_text=
        _("Allows users to see who voted in poll even if poll votes are secret."
          ))
예제 #3
0
class WarningLevelForm(forms.ModelForm):
    name = forms.CharField(label=_("Level name"), max_length=255)
    length_in_minutes = forms.IntegerField(
        label=_("Length in minutes"),
        min_value=0,
        help_text=_("Enter number of minutes since this warning level was "
                    "imposed on member until it's reduced, or 0 to make "
                    "this warning level permanent.")
    )
    restricts_posting_replies = forms.TypedChoiceField(
        label=_("Posting replies"),
        coerce=int,
        choices=RESTRICTIONS_CHOICES
    )
    restricts_posting_threads = forms.TypedChoiceField(
        label=_("Posting threads"),
        coerce=int,
        choices=RESTRICTIONS_CHOICES
    )

    class Meta:
        model = WarningLevel
        fields = [
            'name',
            'length_in_minutes',
            'restricts_posting_replies',
            'restricts_posting_threads',
        ]
예제 #4
0
class PermissionsForm(LimitedPermissionsForm):
    can_warn_users = forms.YesNoSwitch(label=_("Can warn users"))
    can_be_warned = forms.YesNoSwitch(label=_("Can be warned"), initial=False)
    can_cancel_warnings = forms.TypedChoiceField(
        label=_("Can cancel warnings"),
        coerce=int,
        choices=NO_OWNED_ALL,
        initial=0)
    can_delete_warnings = forms.TypedChoiceField(
        label=_("Can delete warnings"),
        coerce=int,
        choices=NO_OWNED_ALL,
        initial=0)
예제 #5
0
def StaffFlagUserFormFactory(FormType, instance, add_staff_field):
    FormType = UserFormFactory(FormType, instance)

    if add_staff_field:
        staff_levels = (
            (0, _("No access")),
            (1, _("Administrator")),
            (2, _("Superadmin")),
        )

        staff_fields = {
            'staff_level':
            forms.TypedChoiceField(
                label=_("Admin level"),
                help_text=_('Only administrators can access admin sites. '
                            'In addition to admin site access, superadmins '
                            'can also change other members admin levels.'),
                coerce=int,
                choices=staff_levels,
                initial=instance.staff_level),
        }

        return type('StaffUserForm', (FormType, ), staff_fields)
    else:
        return FormType
예제 #6
0
파일: admin.py 프로젝트: qhhonx/Misago
class BanForm(forms.ModelForm):
    test = forms.TypedChoiceField(label=_("Ban type"),
                                  coerce=int,
                                  choices=BANS_CHOICES)
    banned_value = forms.CharField(
        label=_("Banned value"),
        max_length=250,
        help_text=_('This value is case-insensitive and accepts asterisk (*) '
                    'for rought matches. For example, making IP ban for value '
                    '"83.*" will ban all IP addresses beginning with "83.".'),
        error_messages={
            'max_length': _("Banned value can't be longer "
                            "than 250 characters.")
        })
    user_message = forms.CharField(
        label=_("User message"),
        required=False,
        max_length=1000,
        help_text=_("Optional message displayed instead of default one."),
        widget=forms.Textarea(attrs={'rows': 3}),
        error_messages={
            'max_length': _("Message can't be longer than 1000 characters.")
        })
    staff_message = forms.CharField(
        label=_("Team message"),
        required=False,
        max_length=1000,
        help_text=_("Optional ban message for moderators and administrators."),
        widget=forms.Textarea(attrs={'rows': 3}),
        error_messages={
            'max_length': _("Message can't be longer than 1000 characters.")
        })
    valid_until = forms.DateField(
        label=_("Expiration date"),
        required=False,
        input_formats=['%m-%d-%Y'],
        widget=forms.DateInput(format='%m-%d-%Y',
                               attrs={'data-date-format': 'MM-DD-YYYY'}),
        help_text=_('Leave this field empty for this ban to never expire.'))

    class Meta:
        model = Ban
        fields = [
            'test',
            'banned_value',
            'user_message',
            'staff_message',
            'valid_until',
        ]

    def clean_banned_value(self):
        data = self.cleaned_data['banned_value']
        while '**' in data:
            data = data.replace('**', '*')

        if data == '*':
            raise forms.ValidationError(_("Banned value is too vague."))

        return data
예제 #7
0
class ForumOptionsForm(forms.ModelForm):
    is_hiding_presence = forms.YesNoSwitch()

    limits_private_thread_invites_to = forms.TypedChoiceField(
        coerce=int, choices=PRIVATE_THREAD_INVITES_LIMITS_CHOICES)

    subscribe_to_started_threads = forms.TypedChoiceField(
        coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)

    subscribe_to_replied_threads = forms.TypedChoiceField(
        coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)

    class Meta:
        model = get_user_model()
        fields = [
            'is_hiding_presence', 'limits_private_thread_invites_to',
            'subscribe_to_started_threads', 'subscribe_to_replied_threads'
        ]
예제 #8
0
파일: forms.py 프로젝트: vfoss-org/Misago
def create_choice(setting, kwargs, extra):
    if setting.form_field == 'choice':
        kwargs['widget'] = forms.RadioSelect()
    else:
        kwargs['widget'] = forms.Select()

    kwargs['choices'] = extra.get('choices', [])

    if setting.python_type == 'int':
        return forms.TypedChoiceField(coerce='int', **kwargs)
    else:
        return forms.ChoiceField(**kwargs)
예제 #9
0
def SearchUsersForm(*args, **kwargs):
    """
    Factory that uses cache for ranks and roles,
    and makes those ranks and roles typed choice fields that play nice
    with passing values via GET
    """
    ranks_choices = threadstore.get('misago_admin_ranks_choices', 'nada')
    if ranks_choices == 'nada':
        ranks_choices = [('', _("All ranks"))]
        for rank in Rank.objects.order_by('name').iterator():
            ranks_choices.append((rank.pk, rank.name))
        threadstore.set('misago_admin_ranks_choices', ranks_choices)

    roles_choices = threadstore.get('misago_admin_roles_choices', 'nada')
    if roles_choices == 'nada':
        roles_choices = [('', _("All roles"))]
        for role in Role.objects.order_by('name').iterator():
            roles_choices.append((role.pk, role.name))
        threadstore.set('misago_admin_roles_choices', roles_choices)

    extra_fields = {
        'rank': forms.TypedChoiceField(
            label=_("Has rank"),
            coerce=int,
            required=False,
            choices=ranks_choices
        ),
        'role': forms.TypedChoiceField(
            label=_("Has role"),
            coerce=int,
            required=False,
            choices=roles_choices
        )
    }

    FinalForm = type(
        'SearchUsersFormFinal', (SearchUsersFormBase,), extra_fields)
    return FinalForm(*args, **kwargs)
예제 #10
0
파일: posting.py 프로젝트: Bashar/Misago
def ThreadLabelForm(*args, **kwargs):
    labels = kwargs.pop('labels')

    choices = [(0, _("No label"))]
    choices.extend([(label.pk, label.name) for label in labels])

    field = forms.TypedChoiceField(label=_("Thread label"),
                                   coerce=int,
                                   choices=choices)

    FormType = type("ThreadLabelFormFinal", (ThreadLabelFormBase, ),
                    {'label': field})

    return FormType(*args, **kwargs)
예제 #11
0
파일: threads.py 프로젝트: kwangkim/Misago
class CategoryPermissionsForm(forms.Form):
    legend = _("Threads")

    can_see_all_threads = forms.TypedChoiceField(
        label=_("Can see threads"),
        coerce=int,
        initial=0,
        choices=((0, _("Started threads")), (1, _("All threads"))))

    can_start_threads = forms.YesNoSwitch(label=_("Can start threads"))
    can_reply_threads = forms.YesNoSwitch(label=_("Can reply to threads"))

    can_edit_threads = forms.TypedChoiceField(label=_("Can edit threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Own threads")),
                                                       (2, _("All threads"))))
    can_hide_own_threads = forms.TypedChoiceField(
        label=_("Can hide own threads"),
        help_text=_("Only threads started within time limit and "
                    "with no replies can be hidden."),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide threads")), (2,
                                                        _("Delete threads"))))
    thread_edit_time = forms.IntegerField(
        label=_("Time limit for own threads edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own threads."),
        initial=0,
        min_value=0)
    can_hide_threads = forms.TypedChoiceField(label=_("Can hide all threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Hide threads")),
                                                       (2,
                                                        _("Delete threads"))))

    can_pin_threads = forms.TypedChoiceField(label=_("Can pin threads"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Locally")),
                                                      (2, _("Globally"))))
    can_close_threads = forms.YesNoSwitch(label=_("Can close threads"))
    can_move_threads = forms.YesNoSwitch(label=_("Can move threads"))
    can_merge_threads = forms.YesNoSwitch(label=_("Can merge threads"))

    can_edit_posts = forms.TypedChoiceField(label=_("Can edit posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Own posts")),
                                                     (2, _("All posts"))))
    can_hide_own_posts = forms.TypedChoiceField(
        label=_("Can hide own posts"),
        help_text=
        _("Only last posts to thread made within edit time limit can be hidden."
          ),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide posts")), (2, _("Delete posts"))))
    post_edit_time = forms.IntegerField(
        label=_("Time limit for own post edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own posts."),
        initial=0,
        min_value=0)
    can_hide_posts = forms.TypedChoiceField(label=_("Can hide all posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Hide posts")),
                                                     (2, _("Delete posts"))))

    can_see_posts_likes = forms.TypedChoiceField(
        label=_("Can see posts likes"),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Number only")),
                 (2, _("Number and list of likers"))))
    can_like_posts = forms.YesNoSwitch(label=_("Can like posts"))

    can_protect_posts = forms.YesNoSwitch(
        label=_("Can protect posts"),
        help_text=_(
            "Only users with this permission can edit protected posts."))
    can_move_posts = forms.YesNoSwitch(
        label=_("Can move posts"),
        help_text=_("Will be able to move posts to other threads."))
    can_merge_posts = forms.YesNoSwitch(label=_("Can merge posts"))
    can_approve_content = forms.YesNoSwitch(
        label=_("Can approve content"),
        help_text=_("Will be able to see and approve unapproved content."))
    can_report_content = forms.YesNoSwitch(label=_("Can report posts"))
    can_see_reports = forms.YesNoSwitch(label=_("Can see reports"))

    can_hide_events = forms.TypedChoiceField(label=_("Can hide events"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Hide events")),
                                                      (2, _("Delete events"))))
예제 #12
0
class PermissionsForm(forms.Form):
    legend = _("Threads")

    can_see_all_threads = forms.TypedChoiceField(
        label=_("Can see threads"),
        coerce=int,
        initial=0,
        choices=((0, _("Started threads")), (1, _("All threads"))))
    can_start_threads = forms.YesNoSwitch(label=_("Can start threads"))
    can_reply_threads = forms.YesNoSwitch(label=_("Can reply to threads"))
    can_edit_threads = forms.TypedChoiceField(label=_("Can edit threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Own threads")),
                                                       (2, _("All threads"))))
    can_hide_own_threads = forms.TypedChoiceField(
        label=_("Can hide own threads"),
        help_text=_("Only threads started within time limit and "
                    "with no replies can be hidden."),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide threads")), (2,
                                                        _("Delete threads"))))
    thread_edit_time = forms.IntegerField(
        label=_("Time limit for own threads edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own threads."),
        initial=0,
        min_value=0)
    can_hide_threads = forms.TypedChoiceField(label=_("Can hide all threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Hide threads")),
                                                       (2,
                                                        _("Delete threads"))))
    can_edit_posts = forms.TypedChoiceField(label=_("Can edit posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Own posts")),
                                                     (2, _("All posts"))))
    can_hide_own_posts = forms.TypedChoiceField(
        label=_("Can hide own posts"),
        help_text=_("Only last posts to thread made within "
                    "edit time limit can be hidden."),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide posts")), (2, _("Delete posts"))))
    post_edit_time = forms.IntegerField(
        label=_("Time limit for own post edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own posts."),
        initial=0,
        min_value=0)
    can_hide_posts = forms.TypedChoiceField(label=_("Can hide all posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Hide posts")),
                                                     (2, _("Delete posts"))))
    can_protect_posts = forms.YesNoSwitch(
        label=_("Can protect posts"),
        help_text=_("Only users with this permission "
                    "can edit protected posts."))
    can_move_posts = forms.YesNoSwitch(label=_("Can move posts"))
    can_merge_posts = forms.YesNoSwitch(label=_("Can merge posts"))
    can_change_threads_labels = forms.TypedChoiceField(
        label=_("Can change threads labels"),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Own threads")), (2, _("All threads"))))
    can_pin_threads = forms.YesNoSwitch(label=_("Can pin threads"))
    can_close_threads = forms.YesNoSwitch(label=_("Can close threads"))
    can_move_threads = forms.YesNoSwitch(label=_("Can move threads"))
    can_merge_threads = forms.YesNoSwitch(label=_("Can merge threads"))
    can_split_threads = forms.YesNoSwitch(label=_("Can split threads"))
    can_review_moderated_content = forms.YesNoSwitch(
        label=_("Can review moderated content"),
        help_text=_("Will see and be able to accept moderated content."))
    can_report_content = forms.YesNoSwitch(label=_("Can report posts"))
    can_see_reports = forms.YesNoSwitch(label=_("Can see reports"))
    can_hide_events = forms.TypedChoiceField(label=_("Can hide events"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Hide events")),
                                                      (2, _("Delete events"))))
예제 #13
0
class EditUserForm(UserBaseForm):
    new_password = forms.CharField(label=_("Change password to"),
                                   widget=forms.PasswordInput,
                                   required=False)

    is_avatar_locked = forms.YesNoSwitch(
        label=_("Lock avatar"),
        help_text=_("Setting this to yes will stop user from "
                    "changing his/her avatar, and will reset "
                    "his/her avatar to procedurally generated one."))
    avatar_lock_user_message = forms.CharField(
        label=_("User message"),
        help_text=_("Optional message for user explaining "
                    "why he/she is banned form changing avatar."),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)
    avatar_lock_staff_message = forms.CharField(
        label=_("Staff message"),
        help_text=_("Optional message for forum team members explaining "
                    "why user is banned form changing avatar."),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)

    signature = forms.CharField(label=_("Signature contents"),
                                widget=forms.Textarea(attrs={'rows': 3}),
                                required=False)
    is_signature_locked = forms.YesNoSwitch(
        label=_("Lock signature"),
        help_text=_("Setting this to yes will stop user from "
                    "making changes to his/her signature."))
    signature_lock_user_message = forms.CharField(
        label=_("User message"),
        help_text=_("Optional message to user explaining "
                    "why his/hers signature is locked."),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)
    signature_lock_staff_message = forms.CharField(
        label=_("Staff message"),
        help_text=_("Optional message to team members explaining "
                    "why user signature is locked."),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)

    is_hiding_presence = forms.YesNoSwitch(label=_("Hides presence"))
    limits_private_thread_invites_to = forms.TypedChoiceField(
        label=_("Who can add user to private threads"),
        coerce=int,
        choices=PRIVATE_THREAD_INVITES_LIMITS_CHOICES)

    subscribe_to_started_threads = forms.TypedChoiceField(
        label=_("Started threads"), coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)
    subscribe_to_replied_threads = forms.TypedChoiceField(
        label=_("Replid threads"), coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)

    class Meta:
        model = get_user_model()
        fields = [
            'username', 'email', 'title', 'is_avatar_locked',
            'avatar_lock_user_message', 'avatar_lock_staff_message',
            'signature', 'is_signature_locked', 'is_hiding_presence',
            'limits_private_thread_invites_to', 'signature_lock_user_message',
            'signature_lock_staff_message', 'subscribe_to_started_threads',
            'subscribe_to_replied_threads'
        ]

    def clean_signature(self):
        data = self.cleaned_data['signature']

        length_limit = settings.signature_length_max
        if len(data) > length_limit:
            raise forms.ValidationError(
                ungettext(
                    "Signature can't be longer than %(limit)s character.",
                    "Signature can't be longer than %(limit)s characters.",
                    length_limit) % {'limit': length_limit})

        return data
예제 #14
0
class EditUserForm(UserBaseForm):
    IS_STAFF_LABEL = _("Is administrator")
    IS_STAFF_HELP_TEXT = _(
        "Designates whether the user can log into admin sites. "
        "If Django admin site is enabled, this user will need "
        "additional permissions assigned within it to admin "
        "Django modules.")

    IS_SUPERUSER_LABEL = _("Is superuser")
    IS_SUPERUSER_HELP_TEXT = _("Only administrators can access admin sites. "
                               "In addition to admin site access, superadmins "
                               "can also change other members admin levels.")

    IS_ACTIVE_LABEL = _('Is active')
    IS_ACTIVE_HELP_TEXT = _(
        "Designates whether this user should be treated as active. "
        "Turning this off is non-destructible way to remove user accounts.")

    IS_ACTIVE_STAFF_MESSAGE_LABEL = _("Staff message")
    IS_ACTIVE_STAFF_MESSAGE_HELP_TEXT = _(
        "Optional message for forum team members explaining "
        "why user's account has been disabled.")

    new_password = forms.CharField(label=_("Change password to"),
                                   widget=forms.PasswordInput,
                                   required=False)

    is_avatar_locked = forms.YesNoSwitch(
        label=_("Lock avatar"),
        help_text=_("Setting this to yes will stop user from changing "
                    "his/her avatar, and will reset his/her avatar to "
                    "procedurally generated one."))
    avatar_lock_user_message = forms.CharField(
        label=_("User message"),
        help_text=_("Optional message for user explaining "
                    "why he/she is banned form changing avatar."),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)
    avatar_lock_staff_message = forms.CharField(
        label=_("Staff message"),
        help_text=_("Optional message for forum team members explaining "
                    "why user is banned form changing avatar."),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)

    signature = forms.CharField(label=_("Signature contents"),
                                widget=forms.Textarea(attrs={'rows': 3}),
                                required=False)
    is_signature_locked = forms.YesNoSwitch(
        label=_("Lock signature"),
        help_text=_("Setting this to yes will stop user from "
                    "making changes to his/her signature."))
    signature_lock_user_message = forms.CharField(
        label=_("User message"),
        help_text=
        _("Optional message to user explaining why his/hers signature is locked."
          ),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)
    signature_lock_staff_message = forms.CharField(
        label=_("Staff message"),
        help_text=
        _("Optional message to team members explaining why user signature is locked."
          ),
        widget=forms.Textarea(attrs={'rows': 3}),
        required=False)

    is_hiding_presence = forms.YesNoSwitch(label=_("Hides presence"))

    limits_private_thread_invites_to = forms.TypedChoiceField(
        label=_("Who can add user to private threads"),
        coerce=int,
        choices=PRIVATE_THREAD_INVITES_LIMITS_CHOICES)

    subscribe_to_started_threads = forms.TypedChoiceField(
        label=_("Started threads"), coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)
    subscribe_to_replied_threads = forms.TypedChoiceField(
        label=_("Replid threads"), coerce=int, choices=AUTO_SUBSCRIBE_CHOICES)

    class Meta:
        model = get_user_model()
        fields = [
            'username',
            'email',
            'title',
            'is_avatar_locked',
            'avatar_lock_user_message',
            'avatar_lock_staff_message',
            'signature',
            'is_signature_locked',
            'is_hiding_presence',
            'limits_private_thread_invites_to',
            'signature_lock_user_message',
            'signature_lock_staff_message',
            'subscribe_to_started_threads',
            'subscribe_to_replied_threads',
        ]

    def clean_signature(self):
        data = self.cleaned_data['signature']

        length_limit = settings.signature_length_max
        if len(data) > length_limit:
            raise forms.ValidationError(
                ungettext(
                    "Signature can't be longer than %(limit)s character.",
                    "Signature can't be longer than %(limit)s characters.",
                    length_limit) % {'limit': length_limit})

        return data