On Thu, 2006-30-11 at 10:58 -0800, iain duncan wrote:
>
> > Now onto the next problem, unicode and mysql! My dev box has mysql 5,
> > the prod has mysql 4. Gah!
> >
> > Getting data from the db is working fine, putting it in is having
> > problems. I have "spamalot".encode('utf8') on all my strings going in,
> > but this does not seem to work for enum columns and I don't know how to
> > get it to accept them.
> >
> > I rebuilt the mysql tables as character set utf8, and the cols are
> > declared with Unicodecol(). The offending code line looks like this:
> >
> > s = Sale( type="web", total=cart_list.total(), purchaser=p.id,
> > status="pending", sale_key=sale_key.encode('utf8') )
> >
> > appending .encode('utf8') to "web" and "pending" doesn't seem to change
> > anything, and it works at home without it. I get the following
> > traceback:
> >
> > File
> > "/usr/local/lib/python2.4/site-packages/SQLObject-0.7.2b1-py2.4.egg/sqlobject/col.py",
> > line 921, in to_python
> > (self.enumValues, self.name, value), value, state)
> > Invalid: expected a member of ('web', 'store', 'promo') in the EnumCol
> > 'type', got Set(['web']) instead
> >
> > I'm a real newbie to unicode and such, so maybe I'm doing something
> > boneheaded. I do have control of the server
> > so we _could_ install mysql 5 alongside 4 if necessary ...
>
> Ok, now I'm *really* confused. It turns out the sales *are* going into
> the database, even though it crashes the controller and gives me a
> traceback. The record is in there just fine with data just as I would
> expect. I get the exact same behaviour when I enter a record manually
> through the tg shell too. If I enter it manually using an sql query on
> the mysql command line, no problems. I'm sqlObject by the way.
FWIW if anyone is following this, I just dropped all the tables and
rebuilt with tg-admin sql create in case there was a db migration
problem, but am still getting the same traceback and the record is still
going into the table without a problem.
Thanks
Iain
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---