First, allow me to apologize for taking so long to reply. The past several days of work have been unpleasant, to put it mildly. I'm just barely getting myself back to normal.
While I don't have the answer for this, I do have a helpful suggestion: Speak to the folks on the sqlalchemy lists. I know there's a way to define things to do what you need to do. I just don't know *how* to do it. There should be a way to do the conversion as the data is being loaded, though, and that should get you working. On Wed, Mar 30, 2011 at 2:52 AM, Bob Tanner <[email protected]> wrote: > I'm working with a MySQL database where the primary key (resourceid) is a > binary(16). According to the developer guide this binary(16) is a UUID. > > Playing around a bit in python I found that uuid.UUID(bytes=resourceid) > decodes things properly. > > The problem is I'm attempting sprox + CrudRestController is throwing this > error: > > Module sprox.fillerbase:219 in get_value > view > >> value = unicode(value, encoding='utf-8') > > UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 39: > unexpected code byte > > Debugging at the traceback here is what I have for the variable value: > > '<div><div><a class="edit_link" href="\x0c\x15\x96\xe2}C@\'\xab\x > 12\xe0\xcb\xd9\xe0+\x00/1/edit" > style="text-decoration:none">edit</a></div><div><form method="POST" > action="\x0c\x15\x96\xe2}C@\'\xab\x12\xe0\xcb\xd9\xe0+\x00/1" > class="button-to"><input type="hidden" name="_method" value="DELETE" > /><input class="delete-button" onclick="return confirm(\'Are you sure?\');" > value="delete" type="submit" style="background-color: transparent; > float:left; border:0; color: #286571; display: inline; margin: 0; padding: > 0;"/></form></div></div>' > > Using MySQL WorkBench and getting the first row and view the resourceid in > the "Value Viewer" as "Binary" I see this: > > 0c 15 86 e2 7d 43 40 27 ab 12 e- cb d9 e0 2b 00 > > Looks just like the values after the "href=" > > Finally the question. > > How can I decode and encode the resourceid so sprox can use it in my > CrudRestController? > > One answer might be "don't use sprox" and hand write the CRUD by hand. I'd > prefer not not. > > I cannot alter the database as another commerical application is writing to > this table and I do not have the ability to alter the commericial > application. > > Thanks. > -- > Bob Tanner <[email protected]> | Phone : 952-943-8700 > http://www.real-time.com, Linux, OSX, VMware | Fax : 952-943-8500 > Key fingerprint = F785 DDFC CF94 7CE8 AA87 3A9D 3895 26F1 0DDB E378 > > > -- Michael J. Pedersen My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171 Yahoo/pedermj2002, MSN/[email protected] ---------- All humans fail, in both great and small ways we fail continually. Machines fail too. Computers are machines that are managed by humans, the fallout from failure can be spectacular. Your responsibility is to deal with failure, to anticipate it and to eliminate it as far as is humanly and economically wise to achieve. Are your actions part of the problem or part of the solution? -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

