gabrielfalcao/lettuce — pull request #417 by xavfernandez (2014-01-06 15:39:49+00:00)
Title: Fix __repr__ for core classes

__repr__ should return str not unicode

If __repr__ returns unicode, calling repr on the object will force python to convert it to str using ascii codec which has high risk of failure:

```
>>> class A(object):
... def __repr__(self):
... return u"é"
...
>>> A()
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 0: ordinal not in range(128)
```
This can be an issue:
Traceback (most recent call last):
File "./venv/lib/python2.6/site-packages/lettuce/django/management/commands/harvest.py", line 167, in handle
result = runner.run()
File "./venv/lib/python2.6/site-packages/lettuce/__init__.py", line 183, in run
call_hook('after', 'all', total)
File "./venv/lib/python2.6/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "./venv/lib/python2.6/site-packages/lettuce/plugins/reporter.py", line 30, in print_end
self.wrt(str(reason.step))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 83-84: ordinal not in range(128)