python-oauth2
python-oauth2 copied to clipboard
to_unicode_optional_iterator() is broken in python 2.4.3
This snippet doesn't work right in python 2.4.3. It appears again in get_normalized_parameters().
except TypeError, e:
assert 'is not iterable' in str(e)
The problem is that the string describing the TypeError does not contain 'is not iterable' in 2.4.3:
Python 2.4.3 (#1, May 5 2011, 16:39:09)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> l = list(1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: iteration over non-sequence
Python 2.6.4 (r264:75706, Jun 4 2010, 18:20:16)
[GCC 4.4.4 20100503 (Red Hat 4.4.4-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> l = list(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
The snippet seems like it's pretty fragile... depending on the string contents of a built-in exception seems like a very bad idea, but maybe that's just me. More importantly, it seems very unpythonic; while it's short and sweet, it borders on the arcane.
This bit me pretty hard, since there's no note anywhere (that I could find) that mentioned a minimum python version. I had put my interface code together on python 2.6.4, but needed to implement some OAuth stuff on an appliance with 2.4.3... ouch!
Overall I love this project, though. Keep up the good work! I'll post a workaround patch if I come up with a decent solution.
this looks like the same problem I am having.