Hi folks,
I'm stumbling over an error which is is probably a bug... I'm new in pylons
so I might be wrong...
Module: paste.auth.auth_tkt, function encode_ip_timestamp:
def encode_ip_timestamp(ip, timestamp):
ip_chars = ''.join(unicode(map(chr, map(int, ip.split('.')))))
t = int(timestamp)
ts = ((t & 0xff000000) >> 24,
(t & 0xff0000) >> 16,
(t & 0xff00) >> 8,
t & 0xff)
ts_chars = ''.join(map(chr, ts))
return ip_chars + ts_chars
What happens when one part of the IP adress is above 127?
=> the chr() function correctly converts it to a string, but chr() returns
the string with the ascii codec
=> if the string is later on used (e.g. with md5.new()) and converted to
unicode implicitly the conversion fails.
So, the following works:
>> unicode(auth_tkt.encode_ip_timestamp("127.0.0.1", 4711))
The following fails:
>> unicode(auth_tkt.encode_ip_timestamp("127.235.0.1", 4711))
I'm currently on an IP adress which is causing the error in the production
environment on my server - so log-in fails with the following error message:
Line 163: UnicodeDecodeError: 'ascii' codec can't decode byte 0xbb in
position 5: ordinal not in range(128)
I'm wrong or did I find a bug? Or do I have to change some basic encoding
variables?
Regards,
Andrew
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users