class SettingsForm(IndicoForm): api_key = StringField( _('API key'), [DataRequired()], description=_('The API key to access the <tt>ursh</tt> service')) api_host = URLField( _('API host'), [DataRequired()], description= _('The <tt>ursh</tt> API host, providing the interface to generate short URLs' ))
def _get_error_msg(self, result): if result['status'] == 409: return _('Shortcut already exists') elif result['status'] == 400: return _('Malformed shortcut') return result['error'].get('description')