From 691e40bec9f3cb70b590318b4ef7c72dbfc173e8 Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Mon, 19 Jan 2015 15:21:58 +0100 Subject: [PATCH] Chat: Use StringField instead of TextField --- chat/indico_chat/forms.py | 14 +++++++------- chat/indico_chat/plugin.py | 13 +++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/chat/indico_chat/forms.py b/chat/indico_chat/forms.py index e467c75..8c6f292 100644 --- a/chat/indico_chat/forms.py +++ b/chat/indico_chat/forms.py @@ -18,7 +18,7 @@ from __future__ import unicode_literals from flask_pluginengine import current_plugin from wtforms.fields.core import BooleanField -from wtforms.fields.simple import TextField, TextAreaField +from wtforms.fields.simple import StringField, TextAreaField from wtforms.validators import DataRequired, ValidationError from indico.web.forms.base import IndicoForm, generated_data @@ -33,9 +33,9 @@ class EditChatroomForm(IndicoForm): event_specific_fields = {'hidden', 'show_password'} # Room-wide options - name = TextField(_('Name'), [DataRequired()], description=_('The name of the room')) + name = StringField(_('Name'), [DataRequired()], description=_('The name of the room')) description = TextAreaField(_('Description'), description=_('The description of the room')) - password = TextField(_('Password'), description=_('An optional password required to join the room')) + password = StringField(_('Password'), description=_('An optional password required to join the room')) # Event-specific options hidden = BooleanField(_('Hidden'), description=_('Hides the room on public event pages.')) show_password = BooleanField(_('Show password'), description=_('Shows the room password on public event pages.')) @@ -43,10 +43,10 @@ class EditChatroomForm(IndicoForm): class AddChatroomForm(EditChatroomForm): use_custom_server = BooleanField(_('Use custom server')) - custom_server = TextField(_('Custom server'), [UsedIf(lambda form, field: form.use_custom_server.data), - DataRequired()], - filters=[lambda x: x.lower() if x else x], - description=_('External Jabber server.')) + custom_server = StringField(_('Custom server'), [UsedIf(lambda form, field: form.use_custom_server.data), + DataRequired()], + filters=[lambda x: x.lower() if x else x], + description=_('External Jabber server.')) def __init__(self, *args, **kwargs): self._date = kwargs.pop('date') diff --git a/chat/indico_chat/plugin.py b/chat/indico_chat/plugin.py index 8b2edec..32cc6c1 100644 --- a/chat/indico_chat/plugin.py +++ b/chat/indico_chat/plugin.py @@ -21,7 +21,7 @@ from flask_pluginengine import render_plugin_template from wtforms import ValidationError from wtforms.fields.core import BooleanField from wtforms.fields.html5 import URLField -from wtforms.fields.simple import TextField, TextAreaField +from wtforms.fields.simple import StringField, TextAreaField from wtforms.validators import DataRequired from indico.core import signals @@ -46,11 +46,12 @@ from indico_chat.views import WPChatEventPage, WPChatEventMgmt class SettingsForm(IndicoForm): admins = PrincipalField(_('Administrators'), description=_('Users who can manage chatrooms for all events')) - server = TextField(_('XMPP server'), [DataRequired()], description=_('The hostname of the XMPP server')) - muc_server = TextField(_('XMPP MUC server'), [DataRequired()], description=_("The hostname of the XMPP MUC server")) - bot_jid = TextField(_('Bot JID'), [DataRequired()], - description=_("Jabber ID of the XMPP bot. Can be just a username (in that case the default " - "server is assumed) or a username@server.")) + server = StringField(_('XMPP server'), [DataRequired()], description=_('The hostname of the XMPP server')) + muc_server = StringField(_('XMPP MUC server'), [DataRequired()], + description=_("The hostname of the XMPP MUC server")) + bot_jid = StringField(_('Bot JID'), [DataRequired()], + description=_("Jabber ID of the XMPP bot. Can be just a username (in that case the default " + "server is assumed) or a username@server.")) bot_password = UnsafePasswordField(_('Bot Password'), [DataRequired()], description=_("Password for the bot")) notify_admins = BooleanField(_('Notify admins'), description=_("Should chat administrators receive email notifications?"))