getsentry/sentry — pull request #795 by askfor (2013-02-19 08:15:45+00:00)
Title: avoid UnicodeEncodeError when token is not ascii

error log:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 29-49: ordinal not in range(128)
[2013-02-19 06:20:46,992: ERROR/MainProcess] Task sentry.tasks.index.index_event[4de195fe-e607-440c-8b56-b8f23f79d7a1] raised exception: UnicodeEncodeError('ascii', u'document=6&field=text&token=\u9875\u9762\u91cd\u590d\u9012\u4ea4', 28, 34, 'ordinal not in range(128)')
Traceback (most recent call last):
File "/aa/sentry/lib/python2.7/site-packages/celery/task/trace.py", line 228, in trace_task
R = retval = fun(*args, **kwargs)
File "/aa/sentry/lib/python2.7/site-packages/celery/task/trace.py", line 415, in __protected_call__
return self.run(*args, **kwargs)
File "/aa/sentry/lib/python2.7/site-packages/sentry/tasks/index.py", line 16, in index_event
SearchDocument.objects.index(event)
File "/aa/sentry/lib/python2.7/site-packages/sentry/manager.py", line 1084, in index
'field': field,
File "/aa/sentry/lib/python2.7/site-packages/sentry/buffer/redis.py", line 55, in incr
key = self._make_key(model, filters, column)
File "/aa/sentry/lib/python2.7/site-packages/sentry/buffer/redis.py", line 45, in _make_key
md5('&'.join('%s=%s' % (k, self._map_column(model, k, v)) for k, v in sorted(filters.iteritems()))).hexdigest(),
UnicodeEncodeError: 'ascii' codec can't encode characters in position 28-33: ordinal not in range(128)