Bug in SQLStore ?

Jonathan Daugherty cygnus at janrain.com
Fri Apr 6 10:10:50 PDT 2007


# Version 1.2.2 final

That's why.  1.2.2 includes a change to the type conversion of BLOBs
which broke the library.  Neat!  MySQLdb 1.2.1 returns an array.array
object; 1.2.2 and later return a str.  Here's the change:

  http://tinyurl.com/2b4bss

Evidently this change was in response to a "bug" report,

  http://tinyurl.com/ypy25z

For you and others running MySQLdb 1.2.2, I think the cleanest
solution is to just create a new store class and fix blobDecode.
Then, instantiate that store class instead of sqlstore.MySQLStore.

  from openid.store import sqlstore

  class FixedMySQLStore(sqlstore.MySQLStore):
      def blobDecode(self, blob):
          """
          MySQLdb 1.2.2 returns a str, so we don't need to do any
          conversion.
          """
          return blob

  # In RP or server code:
  store = FixedMySQLStore(conn, ...)

-- 
  Jonathan Daugherty
  JanRain, Inc.
  irc.freenode.net: cygnus in #openid
  cygnus.myopenid.com



More information about the Dev mailing list