2009/4/24 Paul Stansifer <[email protected]>: > I just upgraded web.py and Python, and, for the most part, my application > works fine. But it seems as though my app is now feeding unicode strings to > web.py in a couple unexpected places. I can't tell whether it's a bug or > whether I'm doing something systemically wrong: > >>>> import web >>>> web.__version__ > '0.31' >>>> web.db.sqlquote(u"I'm a unicode string") > <sql: 'u"I\'m a unicode string"'>
u'xx' only the python representation. It is not sent with like that to MySQLdb modle. >>>> 'select * from %s' % web.db.sqlquote(u'my_table') > "select * from u'my_table'" Why do you want to sqlquote table? sqlquote is used for quoting values. It is not a good idea to use %s replacements in sql. I don't think it is a valid SQL Query to quote table names. >>>> web.ctx.headers = [] #hack so that it's possible to set cookies >>>> web.setcookie(u'key', u'value') > Traceback (most recent call last): > (elided -- see the bottom of this mail for the full stack trace) > File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/string.py", > line 491, in translate > return s.translate(table, deletions) > TypeError: translate() takes exactly one argument (2 given) > > (I observed this same error in the running app, too.) Two-argument > translate() is only defined for str, not for unicode. > > Is this a known issue? Am I misusing strings? Its probably a bug. I'll have look at it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
