Skip to content

Commit

Permalink
try to get rid of unicode strings in __str__(self) of event types
Browse files Browse the repository at this point in the history
  • Loading branch information
megies committed Oct 14, 2015
1 parent a2db9fb commit a4e0ce5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion obspy/core/event.py
Expand Up @@ -337,7 +337,10 @@ def __str__(self, force_one_line=False):
return ret_str + "()"

def get_value_repr(key):
repr_str = getattr(self, key).__repr__()
value = getattr(self, key)
if isinstance(value, (str, native_str)):
value = native_str(value)
repr_str = value.__repr__()
# Print any associated errors.
error_key = key + "_errors"
if hasattr(self, error_key) and\
Expand Down

1 comment on commit a4e0ce5

@megies
Copy link
Member Author

@megies megies commented on a4e0ce5 Oct 14, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QuLogic, is it correct to use native_str for this? Still confused by the futuresque str handling across Py2/3.

Please sign in to comment.