Changeset 71 for trunk/lib


Ignore:
Timestamp:
08/26/14 18:37:44 (10 years ago)
Author:
tim
Message:

chosenct and http2py convenience fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bletchley/chosenct.py

    r65 r71  
    7575
    7676    def _generate_colors(self, s):
     77        if isinstance(s, str):
     78            s = s.encode('utf-8')
    7779        base=bytes(hashlib.md5(s).digest()[0:6])
    7880        color1 = "#%.2X%.2X%.2X" % tuple(base[:3])
     
    9698                message = self._raw_table[offset][v]
    9799                bg,fg = self._generate_colors(message)
    98                 message = message.decode('utf-8')
     100                if not isinstance(message, str):
     101                    message = message.decode('utf-8')
    99102
    100103                truncated = message[0:maxlen]
Note: See TracChangeset for help on using the changeset viewer.