예제 #1
0
class TokenDeleteForm(form.Form):

    ignoreContext = True

    label = _(u"heading_delete_token", default="TokenRole: Delete token")
    successMessage = _('data_saved', default='Data successfully updated.')
    noChangesMessage = _('no_changes', default='No changes were applied.')

    # Defining the fields. You can add fields together.
    fields = field.Fields(
        TextLine(__name__='token_display',
                 title=ITokenInfoSchema['token_id'].title,
                 description=ITokenInfoSchema['token_id'].description)
    ) + field.Fields(ITokenInfoSchema).select(*['token_id'])

    fields['token_id'].mode = HIDDEN_MODE
    fields['token_display'].mode = DISPLAY_MODE

    def updateWidgets(self):
        super(TokenDeleteForm, self).updateWidgets()
        self.widgets['token_display'].value = self.request.get(
            'form.widgets.token_id')
        # for some reasons this is not taken from the request otherwise
        self.widgets['token_id'].value = self.request.get(
            'form.widgets.token_id')

    def nextURL(self):
        context = self.getContent()
        data, errors = self.extractData()
        return "%s/@@token_manage" % (context.absolute_url())

    # Handler for the submit action
    @button.buttonAndHandler(_(u'delete_token', default=u'Delete token'),
                             name='delete')
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _(u'errors')
            return

        context = self.getContent()
        tr_annotate = ITokenRolesAnnotate(context)
        if data['token_id'] in tr_annotate.token_dict:
            del tr_annotate.token_dict[data['token_id']]

        self.status = _(u'delete_success', default=u"Token removed")
        self.request.response.redirect(self.nextURL())
        api.portal.show_message(self.status, request=self.request)

    @button.buttonAndHandler(_(u'Cancel', default=u'Cancel'), name='cancel')
    def handle_cancel(self, action):
        self.status = self.noChangesMessage
        self.request.response.redirect(self.nextURL())
        api.portal.show_message(self.status, request=self.request)
예제 #2
0
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _(u"delete_error", default="An error has occurred")
            return

        context = self.getContent()
        tr_annotate = ITokenRolesAnnotate(context)
        if tr_annotate.token_dict.has_key(data['token_id']):
            del tr_annotate.token_dict[data['token_id']]

        self.status = _(u'delete_success', default=u"Token removed")
        self.request.response.redirect(self.nextURL())
        IStatusMessage(self.request).addStatusMessage(self.status, type='info')
예제 #3
0
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _(u'errors')
            return

        context = self.getContent()
        tr_annotate = ITokenRolesAnnotate(context)
        if data['token_id'] in tr_annotate.token_dict:
            del tr_annotate.token_dict[data['token_id']]

        self.status = _(u'delete_success', default=u"Token removed")
        self.request.response.redirect(self.nextURL())
        api.portal.show_message(self.status, request=self.request)
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _(u"delete_error", default="An error has occurred")
            return

        context = self.getContent()
        tr_annotate = ITokenRolesAnnotate(context)
        if data['token_id'] in tr_annotate.token_dict:
            del tr_annotate.token_dict[data['token_id']]

        self.status = _(u'delete_success', default=u"Token removed")
        self.request.response.redirect(self.nextURL())
        IStatusMessage(self.request).addStatusMessage(self.status, type='info')
예제 #5
0
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _('errors')
            return

        # do something usefull, here we send the mail and
        # set the status message
        self.status = self.send_mail(data)
        self.request.response.redirect(self.nextURL())
예제 #6
0
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _('token_role_send_ko', default=u'An error has occurred')
            return

        # do something usefull, here we send the mail and
        # set the status message
        self.status = self.send_mail(data)
        self.request.response.redirect(self.nextURL())
예제 #7
0
class TokenAddForm(form.AddForm):
    """ Token Add Form """

    # Defining the fields
    fields = field.Fields(ITokenInfoSchema)
    fields['token_id'].mode = HIDDEN_MODE
    fields['token_roles'].widgetFactory[INPUT_MODE] = CheckBoxFieldWidget

    label = _(u"heading_add_token", default="TokenRole: Add token")
    successMessage = _('data_saved', default='Data successfully updated.')
    formErrorsMessage = _('form_errors', default='There were some errors.')
    noChangesMessage = _('no_changes', default='No changes were applied.')

    def updateWidgets(self):
        super(TokenAddForm, self).updateWidgets()
        self.widgets['token_id'].value = make_uuid(self.getContent().getId())

        end_date = datetime.datetime.now() + datetime.timedelta(
            DEFAULT_TOKEN_DAYS)
        try:
            delta = self.context.REQUEST.get('t', None)
            delta_dt = datetime.datetime.fromtimestamp(float(delta))
            self.widgets['token_end'].value = (delta_dt.year, delta_dt.month,
                                               delta_dt.day, delta_dt.hour,
                                               delta_dt.minute)
        except:
            self.widgets['token_end'].value = (end_date.year, end_date.month,
                                               end_date.day, 0, 0)

    def createAndAdd(self, data):
        context = self.getContent()
        applyChanges(self, context, data)
        self.status = self.successMessage
        return context

    def nextURL(self):
        IStatusMessage(self.request).addStatusMessage(self.status, type='info')
        return "%s/%s" % (self.getContent().absolute_url(), '@@token_manage')

    def update(self):
        self.buttons.values()[0].title = _(u'add_token', default=u"Add token")
        super(TokenAddForm, self).update()
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _('token_role_send_ko', default=u'An error has occurred')
            return

        #do something usefull, here we send the mail and
        # set the status message
        self.status = self.send_mail(data)

        self.request.response.redirect(self.nextURL())
    def send_mail(self, data):
        # Collect mail settings
        context = self.getContent()
#        message = _('token_message_text', default="""${text}s<br/>Date: ${date}s<br/>Url: <a href="${url}s">Access<a/> """)
#        message = context.utranslate(message)
        portal = getMultiAdapter((context, self.request), name="plone_portal_state").portal()
        mailhost = getToolByName(context, 'MailHost')

        email_list = data['email_list']
        subject = safe_unicode(data['subject'])
        text = safe_unicode(data['text'])
        token_id = data['token_id']
        url = "%s?token=%s" % (context.absolute_url(), token_id)
        if IATBTreeFolder.providedBy(context):
            url = "%s/private_token_listing?token=%s" % (context.absolute_url(), token_id)

        email_charset = portal.getProperty('email_charset')
        from_address = portal.getProperty('email_from_address')

#        tr_annotate = ITokenRolesAnnotate(context)
#        end_date = context.toLocalizedTime(tr_annotate.token_dict[token_id]['token_end'])
        util = getToolByName(self.context, 'translation_service')
        end_date = util.ulocalized_time(time.time(), long_format = None, time_only = None, context = self.context, domain='plonelocales')


#        message = message.replace('${text}s', text)
        message = text.replace('${date}s', str(end_date))
        message = message.replace('${url}s', url)

        try:
            for email_recipient in email_list:
                mailhost.secureSend(message, email_recipient, from_address,
                                    subject=subject,
                                    charset=email_charset, debug=False,
                                   )
        except (MailHostError, SMTPException):
            return _('token_role_send_ko_mail', default=u'Mail error')
        except Exception:
            return _('token_role_send_ko', default=u'An error has occurred')
        else:
            return _('token_role_send_ok', default=u'Token sent')
예제 #10
0
class ITokenInfoSchema(Interface):
    """info used to manage the token
    """

    token_id = TextLine(
        title=_(u'label_token_value', default=u'Token Value'),
        description=_(u'help_token_value',
                      default=u'Value to assign to token'),
        required=True)

    token_end = Datetime(
        title=_(u'label_token_validity',
                default=u'Token expiration date'),
        description=_(u'help_token_validity',
                      default=u"From this date this token will be useless"),
        defaultFactory=tokenEndDefaultValue,
        required=True)

    token_roles = List(
        title=_(u'label_roles', default=u'Roles'),
        description=_(u'help_roles',
                      default=u"Roles to be assigned to this token's receiver"),
        required=True,
        default=['Reader'],
        value_type=Choice(vocabulary='redomino.tokenrole.Roles', ))
예제 #11
0
class TokenAddForm(form.AddForm):
    """ Token Add Form """

    # Defining the fields
    fields = field.Fields(ITokenInfoSchema)
    fields['token_id'].mode = HIDDEN_MODE
    fields['token_roles'].widgetFactory[INPUT_MODE] = CheckBoxFieldWidget

    label = _(u"heading_add_token", default="TokenRole: Add token")
    successMessage = _('data_saved', default='Data successfully updated.')
    formErrorsMessage = _('errors')
    noChangesMessage = _('no_changes', default='No changes were applied.')

    def updateWidgets(self):
        super(TokenAddForm, self).updateWidgets()
        uuid_generator = getUtility(IUUIDGenerator)
        self.widgets['token_id'].value = uuid_generator()
        delta = self.request.get('t')
        if delta:
            delta = delta.encode('ascii', 'ignore')
            delta_dt = datetime.datetime.fromtimestamp(float(delta))
            # '2000-10-30 15:40'
            # self.widgets['token_end'].value = delta_dt.strftime('%Y-%m-%d %H:%M')
            self.widgets['token_end'].value = (delta_dt.year, delta_dt.month,
                                               delta_dt.day, delta_dt.hour,
                                               delta_dt.minute)

    def createAndAdd(self, data):
        context = self.getContent()
        applyChanges(self, context, data)
        self.status = self.successMessage
        return context

    def nextURL(self):
        api.portal.show_message(self.status, request=self.request)
        return "%s/%s" % (self.getContent().absolute_url(), '@@token_manage')

    def update(self):
        self.buttons.values()[0].title = _(u'add_token', default=u"Add token")
        super(TokenAddForm, self).update()
예제 #12
0
class ITokenSendForm(Interface):
    """ Form invio token ad una lista di email """

    token_id = schema.ASCIILine(
        title=_(u'label_tokenrole_token_id', default=u'Token id'),
        description=_(u'help_tokenrole_token_id',
                      default=u'This token is going to be distributed.'),
        required=True)

    subject = schema.TextLine(
        title=_(u'label_tokenrole_subject', default=u'Subject'),
        description=_(
            u'help_tokenrole_subject',
            default=u'Please enter the subject of the message you want to send.'
        ),
        required=True)

    text = schema.Text(
        title=_(u'label_tokenrole_text', default=u'Email body message'),
        description=_(
            u'help_tokenrole_text',
            default=
            u"Please enter here the message you want to send. Please, do not remove ${date} and ${url} tokens or the email won't be complete."
        ),
        default=
        _(u"Please replace this text with your own message, but do not change under the next line.\n-----------------\nDate: ${date}s\nUrl: ${url}s"
          ),
        required=True,
    )

    email_list = schema.List(
        title=_(u'label_tokenrole_email_list', default=u'List of emails'),
        description=_(
            u'help_tokenrole_email_list',
            default=u'Please enter here the list of emails. One per line'),
        required=True,
        default=[],
        value_type=schema.ASCIILine(title=_(u'label_email', default="Email"),
                                    constraint=isEmail),
    )
예제 #13
0
    def send_mail(self, data):
        current_user = api.user.get_current()
        sender = current_user.getProperty('email', default=None)
        email_list = data['email_list']
        subject = safe_unicode(data['subject'])
        text = safe_unicode(data['text'])
        token_id = data['token_id']
        url = ITokenURL(self.context)(token_id)
        token_info = ITokenInfoSchema(self.context)
        loc_token_end = api.portal.get_localized_time(token_info.token_end)

        message = text.replace('${date}s', str(loc_token_end))
        message = message.replace('${url}s', url)

        try:
            for recipient in email_list:
                api.portal.send_email(
                    sender=sender,
                    recipient=recipient, subject=subject, body=message)
            return _('token_role_send_ok_mail', default=u'Token email sent.')
        except ValueError:
            return _('token_role_send_ko_mail', default=u'Error sending email.')
예제 #14
0
    def send_mail(self, data):
        # Collect mail settings
        context = self.getContent()
#        message = _('token_message_text', default="""${text}s<br/>Date: ${date}s<br/>Url: <a href="${url}s">Access<a/> """)
#        message = context.utranslate(message)
        portal = getMultiAdapter((context, self.request), name="plone_portal_state").portal()
        mailhost = getToolByName(context, 'MailHost')

        email_list = data['email_list']
        subject = safe_unicode(data['subject'])
        text = safe_unicode(data['text'])
        token_id = data['token_id']
        url = "%s?token=%s" % (context.absolute_url(), token_id)

        email_charset = portal.getProperty('email_charset')
        from_address = portal.getProperty('email_from_address')
        
#        tr_annotate = ITokenRolesAnnotate(context)
#        end_date = context.toLocalizedTime(tr_annotate.token_dict[token_id]['token_end'])
        util = getToolByName(self.context, 'translation_service')
        end_date = util.ulocalized_time(time.time(), long_format = None, time_only = None, context = self.context, domain='plonelocales')


#        message = message.replace('${text}s', text)
        message = text.replace('${date}s', str(end_date))
        message = message.replace('${url}s', url)

        try:
            for email_recipient in email_list:
                mailhost.secureSend(message, email_recipient, from_address,
                                    subject=subject,
                                    charset=email_charset, debug=False,
                                   )
        except (MailHostError, SMTPException):
            return _('token_role_send_ko_mail', default=u'Mail error')
        except Exception:
            return _('token_role_send_ko', default=u'An error has occurred')
        else:
            return _('token_role_send_ok', default=u'Token sent')
예제 #15
0
class TokenEditForm(form.EditForm):
    """ Token Edit Form """

    # Defining the fields
    fields = field.Fields(
        TextLine(__name__='token_display',
                 title=ITokenInfoSchema['token_id'].title,
                 description=ITokenInfoSchema['token_id'].description)
    ) + field.Fields(ITokenInfoSchema)
    fields['token_id'].mode = HIDDEN_MODE
    fields['token_display'].mode = DISPLAY_MODE
    fields['token_roles'].widgetFactory[INPUT_MODE] = CheckBoxFieldWidget

    label = _(u"heading_edit_token", default="TokenRole: Modify token")
    successMessage = _('data_saved', default='Data successfully updated.')
    noChangesMessage = _('no_changes', default='No changes were applied.')
    formErrorsMessage = _('errors', default='There were some errors.')

    def updateWidgets(self):
        super(TokenEditForm, self).updateWidgets()
        self.widgets['token_display'].value = self.request.get(
            'form.widgets.token_id')

    def nextURL(self):
        context = self.getContent()
        data, errors = self.extractData()
        return "%s/@@token_manage" % (context.absolute_url())

    @button.buttonAndHandler(_(u'modify_token', default=u"Modify token"),
                             name='apply')
    def handleApply(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return
        changes = self.applyChanges(data)
        if changes:
            self.status = self.successMessage
        else:
            self.status = self.noChangesMessage

        nextURL = self.nextURL()
        if nextURL:
            IStatusMessage(self.request).addStatusMessage(self.status,
                                                          type='info')
            self.request.response.redirect(self.nextURL())
        return ''

    @button.buttonAndHandler(_(u'label_cancel', default=u'Cancel'),
                             name='cancel')
    def handle_cancel(self, action):
        self.status = self.noChangesMessage
        self.request.response.redirect(self.nextURL())
        IStatusMessage(self.request).addStatusMessage(self.status, type='info')
        return
예제 #16
0
    def send_mail(self, data):
        email_list = data['email_list']
        subject = safe_unicode(data['subject'])
        text = safe_unicode(data['text'])
        token_id = data['token_id']
        url = ITokenURL(self.context)(token_id)
        token_info = ITokenInfoSchema(self.context)
        loc_token_end = api.portal.get_localized_time(token_info.token_end)

        message = text.replace('${date}s', str(loc_token_end))
        message = message.replace('${url}s', url)

        try:
            for recipient in email_list:
                api.portal.send_email(
                    recipient=recipient, subject=subject, body=message)
        except ValueError:
            return _('token_role_send_ko_mail', default=u'Error sending email')
예제 #17
0
 def get_time_deltas(self):
     now = datetime.datetime.now()
     deltas = []
     tmp = time.mktime((now + datetime.timedelta(hours=2)).timetuple())
     deltas.append(('+2' + self.context.translate(_(u'hours')), tmp))
     tmp = time.mktime((now + datetime.timedelta(hours=4)).timetuple())
     deltas.append(('+4' + self.context.translate(_(u'hours')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=1)).timetuple())
     deltas.append(('+1' + self.context.translate(_(u'day')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=7)).timetuple())
     deltas.append(('+7' + self.context.translate(_(u'days')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=15)).timetuple())
     deltas.append(('+15' + self.context.translate(_(u'days')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=30)).timetuple())
     deltas.append(('+30' + self.context.translate(_(u'days')), tmp))
     return deltas
예제 #18
0
 def get_time_deltas(self):
     now = datetime.datetime.now()
     deltas = []
     tmp = time.mktime((now + datetime.timedelta(hours=2)).timetuple())
     deltas.append(('+2' + self.context.translate(_(u'hours')), tmp))
     tmp = time.mktime((now + datetime.timedelta(hours=4)).timetuple())
     deltas.append(('+4' + self.context.translate(_(u'hours')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=1)).timetuple())
     deltas.append(('+1' + self.context.translate(_(u'day')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=7)).timetuple())
     deltas.append(('+7' + self.context.translate(_(u'days')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=15)).timetuple())
     deltas.append(('+15' + self.context.translate(_(u'days')), tmp))
     tmp = time.mktime((now + datetime.timedelta(days=30)).timetuple())
     deltas.append(('+30' + self.context.translate(_(u'days')), tmp))
     return deltas
class TokenSendForm(form.Form):
    """ A simple feedback form to send a message to the site admin """

    ignoreContext = True

    label = _('label_send_form', default=u'Send token form')
    successMessage = _('data_saved', default='Data successfully updated.')
    noChangesMessage = _('no_changes', default='No changes were applied.')

    # Defining the fields. You can add fields together.
    fields = field.Fields(TextLine(__name__='token_display',
                                   title=ITokenSendForm['token_id'].title,
                                   description=ITokenSendForm['token_id'].description)) + field.Fields(ITokenSendForm)
    fields['token_id'].mode = HIDDEN_MODE
    fields['token_display'].mode = DISPLAY_MODE

    def updateWidgets(self):
        super(TokenSendForm, self).updateWidgets()
        self.widgets['token_display'].value = self.request.get('form.widgets.token_id')

    # Handler for the submit action
    @button.buttonAndHandler(_(u'label_send_token', default=u'Send'), name='send')
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _('token_role_send_ko', default=u'An error has occurred')
            return

        #do something usefull, here we send the mail and
        # set the status message
        self.status = self.send_mail(data)

        self.request.response.redirect(self.nextURL())

    @button.buttonAndHandler(_(u'label_cancel', default=u'Cancel'), name='cancel')
    def handle_cancel(self, action):
        self.status = self.noChangesMessage
        self.request.response.redirect(self.nextURL())
        return

    def nextURL(self):
        IStatusMessage(self.request).addStatusMessage(self.status, type='info')
        return "%s/%s" % (self.getContent().absolute_url(), '@@token_manage')

    def send_mail(self, data):
        # Collect mail settings
        context = self.getContent()
#        message = _('token_message_text', default="""${text}s<br/>Date: ${date}s<br/>Url: <a href="${url}s">Access<a/> """)
#        message = context.utranslate(message)
        portal = getMultiAdapter((context, self.request), name="plone_portal_state").portal()
        mailhost = getToolByName(context, 'MailHost')

        email_list = data['email_list']
        subject = safe_unicode(data['subject'])
        text = safe_unicode(data['text'])
        token_id = data['token_id']
        url = "%s?token=%s" % (context.absolute_url(), token_id)
        if IATBTreeFolder.providedBy(context):
            url = "%s/private_token_listing?token=%s" % (context.absolute_url(), token_id)

        email_charset = portal.getProperty('email_charset')
        from_address = portal.getProperty('email_from_address')

#        tr_annotate = ITokenRolesAnnotate(context)
#        end_date = context.toLocalizedTime(tr_annotate.token_dict[token_id]['token_end'])
        util = getToolByName(self.context, 'translation_service')
        end_date = util.ulocalized_time(time.time(), long_format = None, time_only = None, context = self.context, domain='plonelocales')


#        message = message.replace('${text}s', text)
        message = text.replace('${date}s', str(end_date))
        message = message.replace('${url}s', url)

        try:
            for email_recipient in email_list:
                mailhost.secureSend(message, email_recipient, from_address,
                                    subject=subject,
                                    charset=email_charset, debug=False,
                                   )
        except (MailHostError, SMTPException):
            return _('token_role_send_ko_mail', default=u'Mail error')
        except Exception:
            return _('token_role_send_ko', default=u'An error has occurred')
        else:
            return _('token_role_send_ok', default=u'Token sent')
예제 #20
0
 def update(self):
     self.form.buttons = button.Buttons(
         self.form.buttons,
         button.Button('cancel', _(u'Cancel')))
     super(CancelActions, self).update()
예제 #21
0
 def update(self):
     self.buttons.values()[0].title = _(u'add_token', default=u"Add token")
     super(TokenAddForm, self).update()
예제 #22
0
 def update(self):
     self.form.buttons = button.Buttons(
         self.form.buttons, button.Button('cancel', _(u'Cancel')))
     super(CancelActions, self).update()
예제 #23
0
class TokenSendForm(form.Form):
    """ A simple feedback form to send a message to the site admin """

    ignoreContext = True

    label = _('label_send_form', default=u'Send token form')
    successMessage = _('data_saved', default='Data successfully updated.')
    noChangesMessage = _('no_changes', default='No changes were applied.')

    # Defining the fields. You can add fields together.
    fields = field.Fields(
        TextLine(__name__='token_display',
                 title=ITokenSendForm['token_id'].title,
                 description=ITokenSendForm['token_id'].description)
    ) + field.Fields(ITokenSendForm)
    fields['token_id'].mode = HIDDEN_MODE
    fields['token_display'].mode = DISPLAY_MODE

    def updateWidgets(self):
        super(TokenSendForm, self).updateWidgets()
        self.widgets['token_display'].value = self.request.get(
            'form.widgets.token_id')

    # Handler for the submit action
    @button.buttonAndHandler(_(u'label_send_token', default=u'Send'),
                             name='send')
    def handle_submit(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = _('token_role_send_ko',
                            default=u'An error has occurred')
            return

        # do something usefull, here we send the mail and
        # set the status message
        self.status = self.send_mail(data)
        self.request.response.redirect(self.nextURL())

    @button.buttonAndHandler(_(u'label_cancel', default=u'Cancel'),
                             name='cancel')
    def handle_cancel(self, action):
        self.status = self.noChangesMessage
        self.request.response.redirect(self.nextURL())
        return

    def nextURL(self):
        IStatusMessage(self.request).addStatusMessage(self.status, type='info')
        return "%s/%s" % (self.getContent().absolute_url(), '@@token_manage')

    def send_mail(self, data):
        email_list = data['email_list']
        subject = safe_unicode(data['subject'])
        text = safe_unicode(data['text'])
        token_id = data['token_id']
        url = ITokenURL(self.context)(token_id)
        token_info = ITokenInfoSchema(self.context)
        loc_token_end = api.portal.get_localized_time(token_info.token_end)

        message = text.replace('${date}s', str(loc_token_end))
        message = message.replace('${url}s', url)

        try:
            for recipient in email_list:
                api.portal.send_email(recipient=recipient,
                                      subject=subject,
                                      body=message)
        except ValueError:
            return _('token_role_send_ko_mail', default=u'Error sending email')
예제 #24
0
 def update(self):
     self.buttons.values()[0].title = _(u'add_token', default=u"Add token")
     super(TokenAddForm, self).update()