AndCycle
unread,Oct 2, 2009, 6:44:43 AM10/2/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-users
I simply hit the unicode issue here,
I know I can do this by manual access lol
what I did
Field('rating', type='string', default=u'普遍')
at db definition
then tried to create crud form (yup, I am a lazy guy)
def post():
return dict(form=crud.create(db.uploads))
boom,
it hit a str func at line 91
79 -class StringWidget(FormWidget):
80
81 @staticmethod
82 - def widget(field, value, **attributes):
83 """
84 generates an INPUT text tag.
85
86 see also: :meth:`FormWidget.widget`
87 """
88
89 default = dict(
90 _type = 'text',
91 value = (value!=None and str(value)) or '',
92 )
93 attr = StringWidget._attributes(field, default, **attributes) 94 95
return INPUT(**attr)
here is the traceback
Traceback (most recent call last):
File "gluon/restricted.py", line 178, in restricted
File "C:/Users/AndCycle/Documents/work/corelight/case/web2py/
applications/eland/controllers/upload.py", line 15, in <module>
File "gluon/globals.py", line 102, in <lambda>
File "C:/Users/AndCycle/Documents/work/corelight/case/web2py/
applications/eland/controllers/upload.py", line 9, in post
File "gluon/tools.py", line 1892, in create
File "gluon/tools.py", line 1830, in update
File "gluon/sqlhtml.py", line 624, in __init__
File "gluon/sqlhtml.py", line 91, in widget
UnicodeEncodeError: 'ascii' codec can't encode characters in position
0-1: ordinal not in range(128)