Hello everyone. The databese of my web app is mongodb. I have defined a
table as the following
db.define_table('stu_jb',
Field("zy",label="major",type="list:string",requires=IS_IN_SET(major_lists,multiple=True)),
)
But when I add a record to the table I get the following error
<type 'exceptions.UnicodeEncodeError'> 'ascii' codec can't encode
characters in position 0-1: ordinal not in range(128)
the traceback is as the following:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
File "C:/web2py/applications/soma/views/appadmin.html"
<http://127.0.0.1:8000/admin/edit/soma/views/appadmin.html>, line 201, in
<module>
{{=T("Size of cache:")}}
File "C:\web2py\gluon\sqlhtml.py", line 3270, in __init__
r = represent(field, r or [], record)
File "C:\web2py\gluon\sqlhtml.py", line 68, in represent
return f(value)
File "C:\web2py\gluon\packages\dal\pydal\helpers\methods.py", line 51, in
list_represent
return ', '.join(str(v) for v in (values or []))
File "C:\web2py\gluon\packages\dal\pydal\helpers\methods.py", line 51, in
<genexpr>
return ', '.join(str(v) for v in (values or []))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1:
ordinal not in range(128)
So I use view the detail of my table of mongodb with a software and I find
something wrong:
{
"_id" : ObjectId("56fdff95ecb1c10d2448271d"),
"zy" : [
"aaa"
],
}
As it shows that the field "zy" content is seperated with "," not "||". I
guess this result in the error. Could anyone help me to fix it?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.