Lujeni / matterllo

Simple integration between Trello and Mattermost: send Trello activity notifications to Mattermost channels
MIT License
86 stars 25 forks source link

UnicodeEncodeError - Character "å" breaks Webhooks. #32

Closed MarvinLind closed 7 years ago

MarvinLind commented 7 years ago

Server: Self-hosted Ubuntu 14.04 LTS Created a webhook with "å" in the name. Can't create new or delete the broken webhook.

UnicodeEncodeError at /admin/core/webhook/
'ascii' codec can't encode character u'\xe5' in position 13: ordinal not in range(128)
Request Method: POST
Request URL:    http://<mydomain>/admin/core/webhook/
Django Version: 1.10.3
Exception Type: UnicodeEncodeError
Exception Value:    
'ascii' codec can't encode character u'\xe5' in position 13: ordinal not in range(128)
Exception Location: /usr/local/lib/python2.7/dist-packages/django/utils/encoding.py in force_text, line 80
Python Executable:  /usr/bin/python
Python Version: 2.7.6
Python Path:    
['/opt/matterllo',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages']
Server time:    Mon, 6 Feb 2017 11:53:19 +0000
Environment:

Request Method: POST
Request URL: http://<mydomain>:8000/admin/core/webhook/

Django Version: 1.10.3
Python Version: 2.7.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'formtools',
 'matterllo.core',
 'crispy_forms']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
  39.             response = get_response(request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in wrapper
  544.                 return self.admin_site.admin_view(view)(*args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in inner
  211.             return view(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in changelist_view
  1569.                 response = self.response_action(request, queryset=cl.get_queryset(request))

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py" in response_action
  1305.             response = func(self, request, queryset)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/actions.py" in delete_selected
  37.         queryset, opts, request.user, modeladmin.admin_site, using)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/utils.py" in get_deleted_objects
  163.     to_delete = collector.nested(format_callback)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/utils.py" in nested
  223.             roots.extend(self._nested(root, seen, format_callback))

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/utils.py" in _nested
  209.             ret = [format_callback(obj)]

File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/utils.py" in format_callback
  136.                                    force_text(obj))

File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py" in force_text
  80.                 s = six.text_type(bytes(s), encoding, errors)

Exception Type: UnicodeEncodeError at /admin/core/webhook/
Exception Value: 'ascii' codec can't encode character u'\xe5' in position 13: ordinal not in range(128)
Lujeni commented 7 years ago

Hello @MufflerEU,

Thanks for the debug, i will try to reproduce the bug and fix it this week.

Thanks

cguerrero commented 7 years ago

It also happens when you try to use accent mark in the name of the webhook.

Lujeni commented 7 years ago

@cguerrero Feel free to ping if it's good for you.

cguerrero commented 7 years ago

@Lujeni thanks, I'll try it!!