Hi
When I call the following code :
import gluon.contrib.simplejson as json
def create():
### http://..../create?fields=<fields in json>
va = dict( json.loads(request.vars.fields, encoding='ascii' )
)
return db.book.insert(**va)
With the url:
http://localhost:8000/welcome/service/create?fields={"2brief_description":"ivre",
"Author":"Pucette", "book_id":90}
I get the error:
db.book.insert(**va)
TypeError: insert() keywords must be strings
Any way to make the insert function work with unicode strings?
this works perfectly if I do the following (convert the keywords to
ascii strings):
vo = dict()
for k in va:
vo[str(k)] = va[k]
return db.book.insert(**vo)
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---