toconnell / kdm-manager

An interactive campaign manager for the game "Monster", by Kingdom Death. Development blog and release notes at https://blog.kdm-manager.com This project has no affiliation with Kingdom Death and is a totally independent, fan-maintained project.
http://kdm-manager.com
Other
26 stars 11 forks source link

The ASCII fix from the last release is throwing errors now. #493

Closed toconnell closed 6 years ago

toconnell commented 6 years ago

User OID: 5ab2e0718740d9067512db9a Method: POST URL: http://api.thewatcher.io/survivor/set_name/5ab2e13b8740d90677b16bab JSON: {u'name': u'\n\n Heimdall', u'serialize_on_response': True}

Traceback (most recent call last):
File "/home/toconnell/kdm-manager/v2/api/utils.py", line 539, in wrapper
 return log_event_call(self, *args, **kwargs)
File "/home/toconnell/kdm-manager/v2/api/Models.py", line 861, in log_event
 value = value.encode('ascii','ignore')
AttributeError: 'int' object has no attribute 'encode'
toconnell commented 6 years ago

Fixed this with a quick type check.

toconnell commented 6 years ago

Re-opening. This is still broken. It's more broken now, in fact.

Some of the email error traffic from production:

User OID: 5a808c378740d951e57ef241 Method: POST URL: http://api.thewatcher.io/survivor/toggle_damage/5a7f4b018740d951e57ed529 JSON: {u'location': u'arms_damage_light', u'serialize_on_response': True}

Traceback (most recent call last):
File "/home/toconnell/kdm-manager/v2/api/utils.py", line 539, in wrapper
 return log_event_call(self, *args, **kwargs)
File "/home/toconnell/kdm-manager/v2/api/Models.py", line 966, in log_event
 d['event'] = d['event'].decode('ascii','replace').encode('utf-8','replace')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 58: ordinal not in range(128)

User OID: 5a808c378740d951e57ef241 Method: POST URL: http://api.thewatcher.io/survivor/rm_game_asset/5a7f4b018740d951e57ed529 JSON: {u'type': u'fighting_arts', u'handle': u'strategist', u'serialize_on_response': True}

Traceback (most recent call last):
File "/home/toconnell/kdm-manager/v2/api/utils.py", line 539, in wrapper
 return log_event_call(self, *args, **kwargs)
File "/home/toconnell/kdm-manager/v2/api/Models.py", line 966, in log_event
 d['event'] = d['event'].decode('ascii','replace').encode('utf-8','replace')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 53: ordinal not in range(128)

User OID: 5a059dcd8740d946a02defcf Method: POST URL: http://api.thewatcher.io/survivor/replace_game_assets/5a929cbd8740d96210f0230d JSON: {u'type': u'fighting_arts', u'handles': [u'crazed'], u'user_id': u'5a059dcd8740d946a02defcf', u'serialize_on_response': True}

Traceback (most recent call last):
File "/home/toconnell/kdm-manager/v2/api/utils.py", line 539, in wrapper
 return log_event_call(self, *args, **kwargs)
File "/home/toconnell/kdm-manager/v2/api/Models.py", line 966, in log_event
 d['event'] = d['event'].decode('ascii','replace').encode('utf-8','replace')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc4' in position 38: ordinal not in range(128)
toconnell commented 6 years ago

Looks like this is duplicative now, and is causing the error:

 d['event'] = d['event'].decode('ascii','replace').encode('utf-8','replace')
toconnell commented 6 years ago

Alright, I'm closing this again. I really thing it's fixed now.